]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
Utils: Add yet more methods to this module
authorMatthias Paulmier <matthias.paulmier@etu.u-bordeaux.fr>
Wed, 20 Jun 2018 14:54:00 +0000 (16:54 +0200)
committerMatthias Paulmier <matthias.paulmier@etu.u-bordeaux.fr>
Fri, 22 Jun 2018 12:20:30 +0000 (14:20 +0200)
Move ̀is_make_dir', ̀push_dist_common' and `canonicalize' to this module.

bin/automake.in
lib/Automake/Utils.pm

index dfcab7a9898972d15149cac1b7370a17c49ecfa9..4b5eee4483f72cf8b8ae09d549c3423adef57c1c 100755 (executable)
@@ -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, @_;
-}
-
 
 ################################################################
 
index c273d943e3711bf81f5bc5f84d058a8985dd70ce..61ff25563800bb09bc8afe2f0371314fe7b4df29 100644 (file)
@@ -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;