groff-commit
[Top][All Lists]
Advanced

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

[groff] 50/50: [build]: Perform fewer unnecessary checks.


From: G. Branden Robinson
Subject: [groff] 50/50: [build]: Perform fewer unnecessary checks.
Date: Sat, 21 May 2022 12:17:31 -0400 (EDT)

gbranden pushed a commit to branch master
in repository groff.

commit d5013ededc67d789aaccefa23d625b96431878c5
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Sat May 21 09:41:21 2022 -0500

    [build]: Perform fewer unnecessary checks.
    
    * m4/groff.m4 (GROFF_MAKEINFO, GROFF_TEXI2DVI): Check for makeinfo(1)
      and texi2dvi(1) programs only if building from Git, not a distribution
      archive.
    
    Also make code style more readable.
---
 ChangeLog   |  6 ++++
 m4/groff.m4 | 91 +++++++++++++++++++++++++++++++++++--------------------------
 2 files changed, 58 insertions(+), 39 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index d3b96ec8..be3636d8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2022-05-21  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       * m4/groff.m4 (GROFF_MAKEINFO, GROFF_TEXI2DVI): Check for
+       makeinfo(1) and texi2dvi(1) programs only if building from Git,
+       not a distribution archive.
+
 2022-05-21  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        * doc/doc.am (doc/meintro_fr.ps): Call groff with `-K utf8`
diff --git a/m4/groff.m4 b/m4/groff.m4
index 35552884..d07157bf 100644
--- a/m4/groff.m4
+++ b/m4/groff.m4
@@ -86,54 +86,67 @@ AC_DEFUN([GROFF_PROG_M4], [
 # We need makeinfo from Texinfo 5.0 or newer, for @codequoteundirected.
 # The minor version checking logic is present for future needs.
 
-AC_DEFUN([GROFF_MAKEINFO],
+AC_DEFUN([GROFF_MAKEINFO], [
+  if test -d "$srcdir"/.git
+  then
   # By default automake will set MAKEINFO to MAKEINFO = ${SHELL} <top
   # src dir>/build-aux/missing makeinfo.  As we need a more precise
   # check of makeinfo version, we don't use it.
-  [MAKEINFO=
-     missing=
-     AC_CHECK_PROG([MAKEINFO], [makeinfo], [makeinfo])
-     if test -z "$MAKEINFO"; then
-       missing="missing 'makeinfo'"
-     else
-       AC_MSG_CHECKING([for makeinfo version])
-       # We need an additional level of quoting to make sed's regexps
-       # work.
-       [makeinfo_version=`$MAKEINFO --version 2>&1 \
-        | sed -e 's/^.* \([^ ][^ ]*\)$/\1/' -e '1q'`]
-       AC_MSG_RESULT([$makeinfo_version])
-       # Consider only the first two numbers in version number string.
-       makeinfo_version_major=`IFS=.; set x $makeinfo_version; echo ${2}`
-       makeinfo_version_minor=`IFS=.; set x $makeinfo_version; echo ${3}`
-       makeinfo_version_numeric=`
-         expr ${makeinfo_version_major}000 + $makeinfo_version_minor`
-       if test $makeinfo_version_numeric -lt 5000; then
-         missing="'makeinfo' is too old."
-         MAKEINFO=
-       fi
-     fi
+    MAKEINFO=
+    missing=
+    AC_CHECK_PROG([MAKEINFO], [makeinfo], [makeinfo])
+    if test -z "$MAKEINFO"
+    then
+      missing="missing 'makeinfo'"
+    else
+      AC_MSG_CHECKING([for makeinfo version])
+      # We need an additional level of quoting to make sed's regexps
+      # work.
+      [makeinfo_version=`$MAKEINFO --version 2>&1 \
+       | sed -e 's/^.* \([^ ][^ ]*\)$/\1/' -e '1q'`]
+      AC_MSG_RESULT([$makeinfo_version])
+      # Consider only the first two numbers in version number string.
+      makeinfo_version_major=`IFS=.; set x $makeinfo_version; echo ${2}`
+      makeinfo_version_minor=`IFS=.; set x $makeinfo_version; echo ${3}`
+      makeinfo_version_numeric=`
+        expr ${makeinfo_version_major}000 + $makeinfo_version_minor`
+      if test $makeinfo_version_numeric -lt 5000
+      then
+        missing="'makeinfo' is too old."
+        MAKEINFO=
+      fi
+    fi
 
-     if test -n "$missing"; then
-       infofile=doc/groff.info
-       test -f $infofile || infofile="$srcdir"/$infofile
-       if test ! -f $infofile \
-       || test "$srcdir"/doc/groff.texi -nt $infofile; then
-        AC_MSG_ERROR($missing
+    if test -n "$missing"
+    then
+      infofile=doc/groff.info
+      test -f $infofile || infofile="$srcdir"/$infofile
+      if test ! -f $infofile \
+       || test "$srcdir"/doc/groff.texi -nt $infofile
+      then
+        AC_MSG_ERROR($missing
 [Get the 'texinfo' package version 5.0 or newer.])
-       fi
-     fi
-   AC_SUBST([MAKEINFO])])
+      fi
+    fi
+  AC_SUBST([MAKEINFO])
+  fi
+])
 
 # 'makeinfo' and 'texi2dvi' are distributed together, so if the former
 # is too old, the latter is too.
-AC_DEFUN([GROFF_TEXI2DVI],
-  [AC_REQUIRE([GROFF_MAKEINFO])
-   AC_CHECK_PROG([PROG_TEXI2DVI], [texi2dvi], [texi2dvi], [missing])
-   groff_have_texi2dvi=no
-   if test "$PROG_TEXI2DVI" != missing && test -n "$MAKEINFO"
-   then
+
+AC_DEFUN([GROFF_TEXI2DVI], [
+  if test -d "$srcdir"/.git
+  then
+    AC_REQUIRE([GROFF_MAKEINFO])
+    AC_CHECK_PROG([PROG_TEXI2DVI], [texi2dvi], [texi2dvi], [missing])
+    groff_have_texi2dvi=no
+    if test "$PROG_TEXI2DVI" != missing && test -n "$MAKEINFO"
+    then
       groff_have_texi2dvi=yes
-   fi])
+    fi
+  fi
+])
 
 # grohtml needs the following programs to produce images from tbl(1)
 # tables and eqn(1) equations.



reply via email to

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