groff-commit
[Top][All Lists]
Advanced

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

[groff] 42/50: [build]: Refactor grohtml runtime-dep check.


From: G. Branden Robinson
Subject: [groff] 42/50: [build]: Refactor grohtml runtime-dep check.
Date: Sat, 21 May 2022 12:17:29 -0400 (EDT)

gbranden pushed a commit to branch master
in repository groff.

commit aa5787c1eb1b388ab246a02cdbf2d9267e701494
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Fri May 20 14:40:56 2022 -0500

    [build]: Refactor grohtml runtime-dep check.
    
    Handle missing programs required at runtime by grohtml more gracefully.
    Rename and refactor configuration-time logic to be more understandable.
    
    * configure.ac:
    * m4/groff.m4: Rename `GROFF_HTML_PROGRAMS` macro to
      `GROFF_CHECK_GROHTML_PROGRAMS`.  Rename shell variable `make_htmldoc`
      to `use_grohtml`.  Set it explicitly to "no" or "yes" instead of null
      or not null.
    
    * configure.ac:
    * m4/groff.m4:
    * doc/doc.am: Rename `BUILD_HTML` to `USE_GROHTML`.
    
    * configure.ac: Call `GROFF_GROHTML_PROGRAM_NOTICE`.
    
    * doc/doc.am: Bracket definition of `PROCESSEDDOCFILES_HTML` macro and
      `$(PROCESSEDDOCFILES_HTML)` dependency declaration in Automake `if
      USE_GROHTML` conditional.  This prevents an attempt to build an HTML
      version of the "pic.ms" document that is doomed to fail (noisily).
    
    * m4/groff.m4: Refactor grohtml runtime-dependency program check.  Split
      into two macros: one (`GROFF_CHECK_GROHTML_PROGRAMS`) performs the
      check, the other (`GROFF_GROHTML_PROGRAM_NOTICE`) issues a notice at
      the end of the configuration process if at least one program was not
      found.  Rename `html_docnote` shell variable to `grohtml_notice`.
      Tighten wording of notice.  Drop unused `make_install_htmldoc` and
      `make_uninstall_htmldoc` shell variables.
    
    Also make code style more readable.
---
 ChangeLog    | 33 +++++++++++++++++++++
 configure.ac |  9 +++---
 doc/doc.am   | 22 ++++++++------
 m4/groff.m4  | 96 ++++++++++++++++++++++++++++++++----------------------------
 4 files changed, 103 insertions(+), 57 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index be719813..2e789330 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,36 @@
+2022-05-20  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       Handle missing programs required at runtime by grohtml more
+       gracefully.  Rename and refactor configuration-time logic to be
+       more understandable.
+
+       * configure.ac:
+       * m4/groff.m4: Rename `GROFF_HTML_PROGRAMS` macro to
+       `GROFF_CHECK_GROHTML_PROGRAMS`.  Rename shell variable
+       `make_htmldoc` to `use_grohtml`.  Set it explicitly to "no" or
+       "yes" instead of null or not null.
+
+       * configure.ac:
+       * m4/groff.m4:
+       * doc/doc.am: Rename `BUILD_HTML` to `USE_GROHTML`.
+
+       * configure.ac: Call `GROFF_GROHTML_PROGRAM_NOTICE`.
+
+       * doc/doc.am: Bracket definition of `PROCESSEDDOCFILES_HTML`
+       macro and `$(PROCESSEDDOCFILES_HTML)` dependency declaration
+       in Automake `if USE_GROHTML` conditional.  This prevents an
+       attempt to build an HTML version of the "pic.ms" document that
+       is doomed to fail (noisily).
+
+       * m4/groff.m4: Refactor grohtml runtime-dependency program
+       check.  Split into two macros: one
+       {`GROFF_CHECK_GROHTML_PROGRAMS`} performs the check, the other
+       {`GROFF_GROHTML_PROGRAM_NOTICE`} issues a notice at the end of
+       the configuration process if at least one program was not found.
+       Rename `html_docnote` shell variable to `grohtml_notice`.
+       Tighten wording of notice.  Drop unused `make_install_htmldoc`
+       and `make_uninstall_htmldoc` shell variables.
+
 2022-05-20  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        * m4/groff.m4 (GROFF_GHOSTSCRIPT_VERSION_NOTICE): Add newline at
diff --git a/configure.ac b/configure.ac
index eea5a847..de79302a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -163,7 +163,7 @@ GROFF_G
 GROFF_TMAC
 GROFF_WITH_COMPATIBILITY_WRAPPERS
 GROFF_TARGET_PATH_SEPARATOR
-GROFF_HTML_PROGRAMS
+GROFF_CHECK_GROHTML_PROGRAMS
 GROFF_PDFDOC_PROGRAMS
 GROFF_PNMTOOLS_CAN_BE_QUIET
 GROFF_PNMTOPS_NOSETPAGE
@@ -175,8 +175,8 @@ GROFF_GHOSTSCRIPT_VERSION_CHECK
 gl_GLIBC21
 gl_LOCALCHARSET
 
-# checks for presence of URW fonts (requires ghostscript, which is
-# checked in GROFF_HTML_PROGRAMS
+# Check for presence of URW fonts (these require Ghostscript, which is
+# checked for by GROFF_CHECK_GROHTML_PROGRAMS).
 GROFF_URW_FONTS
 
 AM_CONDITIONAL([BUILD_WINSCRIPTS], [test -n "$make_winscripts"])
@@ -197,7 +197,7 @@ AM_CONDITIONAL([MAKE_DONT_HAVE_RM], [test 
"$groff_is_rm_defined" = no])
 # Some programs have a "g" prefix if an existing groff installation is detected
 AM_CONDITIONAL([USEPROGRAMPREFIX], [test "$g" = g])
 
-AM_CONDITIONAL([BUILD_HTML], [test -n "$make_htmldoc"])
+AM_CONDITIONAL([USE_GROHTML], [test "$use_grohtml" = yes])
 AM_CONDITIONAL([BUILD_PDFDOC], [test -n "$make_pdfdoc"])
 AM_CONDITIONAL([USE_GROFF_ALLOCATOR], [test "$groff_use_own_allocator" = yes])
 AM_CONDITIONAL([HAVE_PDFTOOLS], [test "$groff_have_pdftools" = yes ])
@@ -235,3 +235,4 @@ GROFF_APPRESDIR_CHECK
 GROFF_URW_FONTS_CHECK
 GROFF_UCHARDET_CHECK
 GROFF_GHOSTSCRIPT_VERSION_NOTICE
+GROFF_GROHTML_PROGRAM_NOTICE
diff --git a/doc/doc.am b/doc/doc.am
index c0c29fa6..2a6a08ee 100644
--- a/doc/doc.am
+++ b/doc/doc.am
@@ -57,8 +57,10 @@ GENERATEDDOCFILES = \
   doc/meintro_fr.me \
   doc/meref.me
 # Files generated in the build tree
+if USE_GROHTML
 PROCESSEDDOCFILES_HTML = \
   doc/pic.html
+endif
 PROCESSEDDOCFILES_PDF = \
   doc/automake.pdf \
   doc/groff-man-pages.pdf
@@ -83,7 +85,9 @@ PROCESSEDFILES_DEPS_PS = groff troff grops font/devps/stamp
 PROCESSEDFILES_DEPS_PDF = groff troff gropdf font/devpdf/stamp
 PROCESSEDFILES_DEPS_TXT = groff troff grotty font/devutf8/stamp
 
+if USE_GROHTML
 $(PROCESSEDDOCFILES_HTML): $(PROCESSEDFILES_DEPS_HTML)
+endif
 $(PROCESSEDDOCFILES_PS): $(PROCESSEDFILES_DEPS_PS)
 $(PROCESSEDDOCFILES_PDF): $(PROCESSEDFILES_DEPS_PDF)
 $(PROCESSEDDOCFILES_TXT): $(PROCESSEDFILES_DEPS_TXT)
@@ -105,7 +109,7 @@ doc/automake.pdf: doc/automake.mom pdfmom 
contrib/mom/om.tmac
 
 # GNU PIC html documentation, installed in $(htmldocdir)
 # Other pic*.html files are installed by the local rule
-if BUILD_HTML
+if USE_GROHTML
 htmlpicdir = $(htmldocdir)
 htmlpic_DATA = $(PROCESSEDDOCFILES_HTML)
 HTMLDOCFILESALL = pic*.html
@@ -122,7 +126,7 @@ EXAMPLEFILES = \
   doc/grnexmpl.me
 
 # Generated in the build tree
-if BUILD_HTML
+if USE_GROHTML
 PROCESSEDEXAMPLEFILES_HTML = doc/webpage.html
 else
 PROCESSEDEXAMPLEFILES_HTML =
@@ -142,7 +146,7 @@ dist_docexamples_DATA = $(EXAMPLEFILES)
 nodist_docexamples_DATA = $(PROCESSEDEXAMPLEFILES)
 MOSTLYCLEANFILES += $(PROCESSEDEXAMPLEFILES)
 
-if BUILD_HTML
+if USE_GROHTML
 # webpage.html is generated; webpage*.html files are installed by the
 # local rule.
 HTMLEXAMPLEFILESALL = webpage*.html
@@ -363,7 +367,7 @@ doc/webpage.html: $(doc_srcdir)/webpage.ms
 # We remove groff.css only from an out-of-source build tree.
 mostlyclean-local: mostlyclean_doc
 mostlyclean_doc:
-if BUILD_HTML
+if USE_GROHTML
        if test -d $(doc_builddir); then \
          cd $(doc_builddir) \
          && for f in $(HTMLDOCFILESALL); do \
@@ -381,7 +385,7 @@ endif
        if test $(top_builddir) != $(top_srcdir); then \
          $(RM) $(top_builddir)/doc/groff.css; \
        fi
-if BUILD_HTML
+if USE_GROHTML
        if test -d $(doc_builddir); then \
          cd $(doc_builddir) \
          && for f in $(HTMLEXAMPLEFILESALL); do \
@@ -399,7 +403,7 @@ endif
 
 install-data-hook: install_doc_htmldoc
 install_doc_htmldoc:
-if BUILD_HTML
+if USE_GROHTML
        cd $(doc_builddir) \
        && for f in `ls $(HTMLDOCFILESALL)`; do \
          $(RM) $(DESTDIR)$(htmldocdir)/$$f; \
@@ -425,7 +429,7 @@ install_doc_gnu_eps: $(DOC_GNU_EPS)
        done
 
 install_doc_examples: $(DOC_GNU_EPS)
-if BUILD_HTML
+if USE_GROHTML
        cd $(doc_builddir) \
        && for f in `ls $(HTMLEXAMPLEFILESALL)`; do \
          $(RM) $(DESTDIR)$(exampledir)/$$f; \
@@ -443,7 +447,7 @@ uninstall-hook: \
   uninstall_doc_examples uninstall_doc_htmldoc uninstall_mom
 uninstall_doc_examples:
        $(RM) $(DESTDIR)$(exampledir)/gnu.eps
-if BUILD_HTML
+if USE_GROHTML
        -test -d $(DESTDIR)$(docexamplesdir) \
        && cd $(DESTDIR)$(docexamplesdir) \
        && for f in $(HTMLEXAMPLEFILESALL); do \
@@ -459,7 +463,7 @@ if BUILD_HTML
 endif
 
 uninstall_doc_htmldoc:
-if BUILD_HTML
+if USE_GROHTML
        -test -d $(DESTDIR)$(htmldocdir) \
        && cd $(DESTDIR)$(htmldocdir) \
        && for f in $(HTMLDOCFILESALL); do \
diff --git a/m4/groff.m4 b/m4/groff.m4
index 42779dc9..ec404bdf 100644
--- a/m4/groff.m4
+++ b/m4/groff.m4
@@ -1,5 +1,5 @@
 # Autoconf macros for groff.
-# Copyright (C) 1989-2020 Free Software Foundation, Inc.
+# Copyright (C) 1989-2022 Free Software Foundation, Inc.
 #
 # This file is part of groff.
 #
@@ -135,58 +135,66 @@ AC_DEFUN([GROFF_TEXI2DVI],
       groff_have_texi2dvi=yes
    fi])
 
-# The following programs are needed for grohtml.
+# grohtml needs the following programs to produce images from tbl(1)
+# tables and eqn(1) equations.
 
-AC_DEFUN([GROFF_HTML_PROGRAMS],
-  [make_htmldoc=
-   make_install_htmldoc=
-   make_uninstall_htmldoc=
-   AC_REQUIRE([GROFF_GHOSTSCRIPT_PATH])
-
-   missing=
-   AC_FOREACH([groff_prog],
-     [pnmcut pnmcrop pnmtopng psselect pnmtops],
-     [AC_CHECK_PROG(groff_prog, groff_prog, [found], [missing])
-      if test $[]groff_prog = missing; then
-       missing="$missing 'groff_prog'"
-      fi;])
+AC_DEFUN([GROFF_CHECK_GROHTML_PROGRAMS], [
+  make_htmldoc=no
+  AC_REQUIRE([GROFF_GHOSTSCRIPT_PATH])
+  missing=
+  AC_FOREACH([groff_prog],
+    [pnmcrop pnmcut pnmtopng pnmtops psselect],
+    [AC_CHECK_PROG(groff_prog, groff_prog, [found], [missing])
+     if test $[]groff_prog = missing
+     then
+       missing="$missing 'groff_prog'"
+     fi;])
 
-   test "$GHOSTSCRIPT" = "missing" && missing="$missing 'gs'"
+  test "$GHOSTSCRIPT" = "missing" && missing="'gs' $missing"
 
-   if test -z "$missing"; then
-       make_htmldoc=htmldoc
-       make_install_htmldoc=install_htmldoc
-       make_uninstall_htmldoc=uninstall_htmldoc
-   else
-     plural=`set $missing; test $[#] -gt 1 && echo s`
-     missing=`set $missing
-       missing=""
-       while test $[#] -gt 0
-        do
-          case $[#] in
-            1) missing="$missing$[1]" ;;
-            2) missing="$missing$[1] and " ;;
-            *) missing="$missing$[1], " ;;
-          esac
-          shift
-        done
-        echo $missing`
-
-     docnote=';
-  therefore, it will be possible neither to prepare, nor to install,
-  groff-generated documentation in HTML format.'
+  if test -z "$missing"
+  then
+      make_htmldoc=yes
+  else
+    plural=`set $missing; test $[#] -gt 1 && echo s`
+    oxford=`set $missing; test $[#] -gt 2 && echo ,`
+    missing=`set $missing
+      missing=""
+      while test $[#] -gt 0
+      do
+        case $[#] in
+          1) missing="$missing$[1]" ;;
+          2) missing="$missing$[1]$oxford and " ;;
+          *) missing="$missing$[1], " ;;
+        esac
+        shift
+      done
+      echo $missing`
+    if test $[#] -gt 1
+    then
+      verb=were
+    else
+      verb=was
+    fi
 
-     AC_MSG_WARN([missing program$plural:
+    grohtml_notice="The program$plural $missing $verb not found in \
+\$PATH.
 
-  The program$plural $missing cannot be found in the PATH.
+  Consequently, groff's HTML output driver, 'grohtml', will not work
+  properly.  It will not be possible to prepare or install
+  groff-generated documentation in HTML format.
+"
 
-  Consequently, groff's HTML backend (grohtml) will not work properly$docnote
-     ])
    fi
    AC_SUBST([make_htmldoc])
-   AC_SUBST([make_install_htmldoc])
-   AC_SUBST([make_uninstall_htmldoc])])
+])
 
+AC_DEFUN([GROFF_GROHTML_PROGRAM_NOTICE], [
+  if test "$make_htmldoc" = no
+  then
+    AC_MSG_NOTICE([$grohtml_notice])
+  fi
+])
 
 # To produce PDF docs, we need both awk and ghostscript.
 



reply via email to

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