groff-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[groff] 11/25: XXX version validity check


From: G. Branden Robinson
Subject: [groff] 11/25: XXX version validity check
Date: Tue, 29 Oct 2024 02:26:04 -0400 (EDT)

gbranden pushed a commit to branch master
in repository groff.

commit 180d665d19fea419235ea173dce8b4f4e8a5cf65
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Thu Oct 24 13:27:43 2024 -0500

    XXX version validity check
---
 configure.ac | 10 +++-------
 m4/groff.m4  | 36 +++++++++++++++++++++++++++++++++++-
 2 files changed, 38 insertions(+), 8 deletions(-)

diff --git a/configure.ac b/configure.ac
index 3f86138d5..1f562f033 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,5 +1,5 @@
 # Autoconf configuration file for groff.
-# Copyright (C) 1989-2023 Free Software Foundation, Inc.
+# Copyright (C) 1989-2024 Free Software Foundation, Inc.
 #
 # This file is part of groff.
 #
@@ -25,12 +25,8 @@ AC_INIT([GNU roff],
 
 AC_PREREQ([2.64])
 
-# SHORT_VERSION contains only the number of REVISION before the first
-# '.'; e.g., if REVISION is '3.real.434-5aafd' then SHORT_VERSION is
-# 'x.yy.3', where x and yy are MAJOR_VERSION and MINOR_VERSION,
-# respectively.
-AC_SUBST([SHORT_VERSION],
-       m4_bregexp(AC_PACKAGE_VERSION,[^\(\w+\.\w+\.\w+\).*$],[\1]))
+GROFF_MAKE_SHORT_VERSION
+GROFF_CHECK_VERSION_FORMAT
 
 # Directories where the helper scripts should be found. This must be
 # consistent with the variable build_aux in bootstrap.conf.
diff --git a/m4/groff.m4 b/m4/groff.m4
index 09a4b745f..e37b0d005 100644
--- a/m4/groff.m4
+++ b/m4/groff.m4
@@ -1,5 +1,5 @@
 # Autoconf macros for groff.
-# Copyright (C) 1989-2023 Free Software Foundation, Inc.
+# Copyright (C) 1989-2024 Free Software Foundation, Inc.
 #
 # This file is part of groff.
 #
@@ -16,6 +16,40 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
+# Construct a short form of the groff version string.
+#
+# SHORT_VERSION contains only the number of REVISION before the first
+# '.'; e.g., if REVISION is '3.real.434-5aafd' then SHORT_VERSION is
+# 'x.yy.3', where x and yy are MAJOR_VERSION and MINOR_VERSION,
+# respectively.
+AC_DEFUN([GROFF_MAKE_SHORT_VERSION], [
+  AC_SUBST([SHORT_VERSION],
+          m4_bregexp(AC_PACKAGE_VERSION,[^\(\w+\.\w+\.\w+\).*$],[\1]))
+])
+
+# Verify that the package versioning scheme is useful; GNU troff
+# requires a strictly numeric one in the first three components x.y.z.
+
+AC_DEFUN([GROFF_CHECK_VERSION_FORMAT], [
+  AC_REQUIRE([GROFF_MAKE_SHORT_VERSION])
+  groff_version_format_validity=invalid
+  AC_MSG_CHECKING([checking that groff version string has valid format])
+  if expr "$SHORT_VERSION" : '[[0-9]]\+\.[[0-9]]\+\.[[0-9]]\+' \
+    > /dev/null
+  then
+    groff_version_format_validity=valid
+  fi
+  AC_MSG_RESULT([$SHORT_VERSION $groff_version_format_validity])
+
+  if test "$groff_version_format_validity" = invalid
+  then
+    AC_MSG_NOTICE([groff's version string must start with three decimal
+integers separated by dots.  "$SHORT_VERSION" does not match.
+    ])
+    AC_MSG_ERROR([Aborting.], 1)
+  fi
+])
+
 # Locate a print spooler for certain output formats.
 
 AC_DEFUN([GROFF_PRINT], [



reply via email to

[Prev in Thread] Current Thread [Next in Thread]