From dc79cd192751c0022a21c1d8b4fc57afa845ee3e Mon Sep 17 00:00:00 2001 From: Matthias Paulmier Date: Wed, 20 Jun 2018 16:54:00 +0200 Subject: Utils: Add yet more methods to this module MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Move ̀is_make_dir', ̀push_dist_common' and `canonicalize' to this module. --- bin/automake.in | 49 ------------------------------------------------- lib/Automake/Utils.pm | 50 +++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 49 insertions(+), 50 deletions(-) diff --git a/bin/automake.in b/bin/automake.in index dfcab7a98..4b5eee448 100755 --- a/bin/automake.in +++ b/bin/automake.in @@ -1868,14 +1868,6 @@ sub handle_ALLOCA saw_extension ('.c'); } -# Canonicalize the input parameter. -sub canonicalize -{ - my ($string) = @_; - $string =~ tr/A-Za-z0-9_\@/_/c; - return $string; -} - # Canonicalize a name, and check to make sure the non-canonical name # is never used. Returns canonical name. Arguments are name and a # list of suffixes to check for. @@ -6246,37 +6238,6 @@ sub am_install_var } -################################################################ - -# Each key in this hash is the name of a directory holding a -# Makefile.in. These variables are local to 'is_make_dir'. -my %make_dirs = (); -my $make_dirs_set = 0; - -# is_make_dir ($DIRECTORY) -# ------------------------ -sub is_make_dir -{ - my ($dir) = @_; - if (! $make_dirs_set) - { - foreach my $iter (@configure_input_files) - { - $make_dirs{dirname ($iter)} = 1; - } - # We also want to notice Makefile.in's. - foreach my $iter (@other_input_files) - { - if ($iter =~ /Makefile\.in$/) - { - $make_dirs{dirname ($iter)} = 1; - } - } - $make_dirs_set = 1; - } - return defined $make_dirs{$dir}; -} - ################################################################ # push_required_file ($DIR, $FILE, $FULLFILE) @@ -6674,16 +6635,6 @@ sub require_build_directory_maybe } } -################################################################ - -# Push a list of files onto '@dist_common'. -sub push_dist_common -{ - prog_error "push_dist_common run after handle_dist" - if $handle_dist_run; - push @dist_common, @_; -} - ################################################################ diff --git a/lib/Automake/Utils.pm b/lib/Automake/Utils.pm index c273d943e..61ff25563 100644 --- a/lib/Automake/Utils.pm +++ b/lib/Automake/Utils.pm @@ -26,6 +26,7 @@ use Automake::ChannelDefs; use Automake::Variable 'var'; use Automake::Rule; use Exporter; +use File::Basename; use vars qw (@ISA @EXPORT); @@ -34,7 +35,8 @@ use vars qw (@ISA @EXPORT); @EXPORT = qw ($config_aux_dir $am_config_aux_dir $config_aux_dir_set_in_configure_ac $seen_maint_mode $relative_dir $seen_canonical $am_file_cache &var_SUFFIXES_trigger &locate_aux_dir - &subst &make_paragraphs &flatten); + &subst &make_paragraphs &flatten &canonicalize &push_dist_common + &is_make_dir); # Directory to search for configure-required files. This # will be computed by locate_aux_dir() and can be set using @@ -297,4 +299,50 @@ sub flatten } +# Canonicalize the input parameter. +sub canonicalize +{ + my ($string) = @_; + $string =~ tr/A-Za-z0-9_\@/_/c; + return $string; +} + + +# Push a list of files onto '@dist_common'. +sub push_dist_common +{ + prog_error "push_dist_common run after handle_dist" + if $handle_dist_run; + push @dist_common, @_; +} + +# Each key in this hash is the name of a directory holding a +# Makefile.in. These variables are local to 'is_make_dir'. +my %make_dirs = (); +my $make_dirs_set = 0; + +# is_make_dir ($DIRECTORY) +# ------------------------ +sub is_make_dir +{ + my ($dir) = @_; + if (! $make_dirs_set) + { + foreach my $iter (@configure_input_files) + { + $make_dirs{dirname ($iter)} = 1; + } + # We also want to notice Makefile.in's. + foreach my $iter (@other_input_files) + { + if ($iter =~ /Makefile\.in$/) + { + $make_dirs{dirname ($iter)} = 1; + } + } + $make_dirs_set = 1; + } + return defined $make_dirs{$dir}; +} + 1; -- cgit v1.2.1