]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
Add the Standards.pm library
authorMatthias Paulmier <matt@mpaulmier.home>
Mon, 2 Jul 2018 10:07:22 +0000 (12:07 +0200)
committerMatthias Paulmier <matt@mpaulmier.home>
Mon, 2 Jul 2018 12:05:50 +0000 (14:05 +0200)
The library provides functions for checking that the required files in a given
standard (GNU org GNITS) are present.

bin/automake.in
lib/Automake/Standards.pm [new file with mode: 0644]
lib/Automake/local.mk

index b17ad7bd14809686ed8b86225644d52e646ebf45..301c850e43ee343ea6bd45efafd2ededc3825ca7 100755 (executable)
@@ -70,6 +70,7 @@ use Automake::Requires;
 use Automake::Rule;
 use Automake::RuleDef;
 use Automake::SilentRules;
+use Automake::Standards;
 use Automake::Texi;
 use Automake::Utils;
 use Automake::VarDef;
@@ -90,8 +91,6 @@ sub append_exeext (&$);
 sub check_canonical_spelling;
 sub check_directories_in_var;
 sub check_directory;
-sub check_gnits_standards ();
-sub check_gnu_standards ();
 sub check_libobjs_sources;
 sub check_trailing_slash ($\$);
 sub check_typos ();
@@ -4396,50 +4395,6 @@ sub scan_autoconf_files ()
   @configure_dist_common = @dist_common;
 }
 
-################################################################
-
-# Do any extra checking for GNU standards.
-sub check_gnu_standards ()
-{
-  if ($relative_dir eq '.')
-    {
-      # In top level (or only) directory.
-      require_file ("$am_file.am", GNU,
-                   qw/INSTALL NEWS README AUTHORS ChangeLog/);
-
-      # Accept one of these three licenses; default to COPYING.
-      # Make sure we do not overwrite an existing license.
-      my $license;
-      foreach (qw /COPYING COPYING.LIB COPYING.LESSER/)
-       {
-         if (-f $_)
-           {
-             $license = $_;
-             last;
-           }
-       }
-      require_file ("$am_file.am", GNU, 'COPYING')
-       unless $license;
-    }
-
-  for my $opt ('no-installman', 'no-installinfo')
-    {
-      msg ('error-gnu', option $opt,
-          "option '$opt' disallowed by GNU standards")
-       if option $opt;
-    }
-}
-
-# Do any extra checking for GNITS standards.
-sub check_gnits_standards ()
-{
-  if ($relative_dir eq '.')
-    {
-      # In top level (or only) directory.
-      require_file ("$am_file.am", GNITS, 'THANKS');
-    }
-}
-
 
 ################################################################
 
diff --git a/lib/Automake/Standards.pm b/lib/Automake/Standards.pm
new file mode 100644 (file)
index 0000000..854a271
--- /dev/null
@@ -0,0 +1,74 @@
+# Copyright (C) 2018  Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+package Automake::Standards;
+
+use Automake::Channels;
+use Automake::Global;
+use Automake::Options;
+use Automake::Requires;
+use Automake::Utils;
+use Exporter 'import';
+
+use vars qw (@EXPORT);
+
+@EXPORT = qw (check_gnu_standards check_gnits_standards);
+
+
+# Do any extra checking for GNU standards.
+sub check_gnu_standards ()
+{
+  if ($relative_dir eq '.')
+    {
+      # In top level (or only) directory.
+      require_file ("$am_file.am", GNU,
+                   qw/INSTALL NEWS README AUTHORS ChangeLog/);
+
+      # Accept one of these three licenses; default to COPYING.
+      # Make sure we do not overwrite an existing license.
+      my $license;
+      foreach (qw /COPYING COPYING.LIB COPYING.LESSER/)
+       {
+         if (-f $_)
+           {
+             $license = $_;
+             last;
+           }
+       }
+      require_file ("$am_file.am", GNU, 'COPYING')
+       unless $license;
+    }
+
+  for my $opt ('no-installman', 'no-installinfo')
+    {
+      msg ('error-gnu', option $opt,
+          "option '$opt' disallowed by GNU standards")
+       if option $opt;
+    }
+}
+
+
+# Do any extra checking for GNITS standards.
+sub check_gnits_standards ()
+{
+  if ($relative_dir eq '.')
+    {
+      # In top level (or only) directory.
+      require_file ("$am_file.am", GNITS, 'THANKS');
+    }
+}
+
+
+1;
index b0e0fca664641bb3c2c0ea44772ae64ac92e91e0..46668c65fa3b3f6d221f45e46feb9e7cc96f0d07 100644 (file)
@@ -44,6 +44,7 @@ dist_perllib_DATA = \
   %D%/Rule.pm \
   %D%/RuleDef.pm \
   %D%/SilentRules.pm \
+  %D%/Standards.pm \
   %D%/Texi.pm \
   %D%/Utils.pm \
   %D%/VarAppend.pm \