diff options
author | G. Branden Robinson <g.branden.robinson@gmail.com> | 2022-05-21 09:41:21 -0500 |
---|---|---|
committer | G. Branden Robinson <g.branden.robinson@gmail.com> | 2022-05-21 11:13:09 -0500 |
commit | d5013ededc67d789aaccefa23d625b96431878c5 (patch) | |
tree | b1ddb1cf6bf3b243dcf1ff74dbf028473249d44d /m4 | |
parent | 931c31ab4d8e73854bbc14e2a4c68f8b918af302 (diff) | |
download | groff-git-d5013ededc67d789aaccefa23d625b96431878c5.tar.gz |
[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.
Diffstat (limited to 'm4')
-rw-r--r-- | m4/groff.m4 | 91 |
1 files changed, 52 insertions, 39 deletions
diff --git a/m4/groff.m4 b/m4/groff.m4 index 35552884c..d07157bf5 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. |