From: Stefano Lattarini Date: Mon, 17 Oct 2011 09:38:01 +0000 (+0200) Subject: refactor: improve signature of 'check_directory' sub in automake X-Git-Tag: ng-0.5a~109 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=579b15b79bb494f51e44baaaffc18c8c1e636e63;p=thirdparty%2Fautomake.git 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. --- diff --git a/ChangeLog b/ChangeLog index 4a470bd72..bb0a52156 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2011-10-17 Stefano Lattarini + + 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 parallel-tests: warn on conditional TEST_EXTENSIONS definition diff --git a/automake.in b/automake.in index 00fcbf19f..c218f83a7 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')