groff-commit
[Top][All Lists]
Advanced

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

[groff] 43/50: [build]: Refactor gropdf runtime-dep check.


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

gbranden pushed a commit to branch master
in repository groff.

commit 72d251b9c58e5a5211ff72e05b064604c347646e
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Fri May 20 15:16:44 2022 -0500

    [build]: Refactor gropdf runtime-dep check.
    
    Handle missing programs required to construct files needed at runtime by
    gropdf more gracefully.  Rename and refactor configuration-time logic to
    be more understandable.
    
    * configure.ac:
    * m4/groff.m4: Rename `GROFF_PDFDOC_PROGRAMS` macro to
      `GROFF_CHECK_GROPDF_PROGRAMS`.  Rename shell variable `make_pdfdoc` to
      `use_gropdf`.  Set it explicitly to "no" or "yes" instead of null or
      not null.
    
    * configure.ac:
    * m4/groff.m4:
    * doc/doc.am:
    * contrib/mom/mom.am:
    * contrib/pdfmark/pdfmark.am:
    * contrib/sboxes/sboxes.am: Rename `BUILD_PDFDOC` to `USE_GROPDF`.
    
    * configure.ac: Call `GROFF_GROPDF_PROGRAM_NOTICE`.
    
    * doc/doc.am: Bracket definition of `PROCESSEDDOCFILES_PDF` macro and
      `$(PROCESSEDDOCFILES_PDF)` dependency declaration in Automake `if
      USE_GROPDF` conditional.  This prevents attempts to build PDF
      documents using groff that are doomed to fail.
    
    * m4/groff.m4: Refactor gropdf runtime-dependency program check.  Split
      into two macros: one (`GROFF_CHECK_GROPDF_PROGRAMS`) performs the
      check, the other (`GROFF_GROPDF_PROGRAM_NOTICE`) issues a notice at
      the end of the configuration process if at least one program was not
      found.  Rename `docnote` shell variable to `gropdf_notice`.  Tighten
      wording of notice.  Drop unused `make_install_pdfdoc` and
      `make_uninstall_pdfdoc` shell variables.
    
    Also make code style more readable.
---
 ChangeLog                  | 32 ++++++++++++++++++++++
 configure.ac               |  5 ++--
 contrib/mom/ChangeLog      |  4 +++
 contrib/mom/mom.am         |  4 +--
 contrib/pdfmark/ChangeLog  |  4 +++
 contrib/pdfmark/pdfmark.am |  4 +--
 contrib/sboxes/ChangeLog   |  4 +++
 contrib/sboxes/sboxes.am   |  2 +-
 doc/doc.am                 |  6 +++-
 m4/groff.m4                | 68 +++++++++++++++++++++++++---------------------
 10 files changed, 94 insertions(+), 39 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 2e789330..491ce24f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,35 @@
+2022-05-20  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       Handle missing programs required to construct files needed at
+       runtime by gropdf more gracefully.  Rename and refactor
+       configuration-time logic to be more understandable.
+
+       * configure.ac:
+       * m4/groff.m4: Rename `GROFF_PDFDOC_PROGRAMS` macro to
+       `GROFF_CHECK_GROPDF_PROGRAMS`.  Rename shell variable
+       `make_pdfdoc` to `use_gropdf`.  Set it explicitly to "no" or
+       "yes" instead of null or not null.
+
+       * configure.ac:
+       * m4/groff.m4:
+       * doc/doc.am: Rename `BUILD_PDFDOC` to `USE_GROPDF`.
+
+       * configure.ac: Call `GROFF_GROPDF_PROGRAM_NOTICE`.
+
+       * doc/doc.am: Bracket definition of `PROCESSEDDOCFILES_PDF`
+       macro and `$(PROCESSEDDOCFILES_PDF)` dependency declaration in
+       Automake `if USE_GROPDF` conditional.  This prevents attempts
+       to build PDF documents using groff that are doomed to fail.
+
+       * m4/groff.m4: Refactor gropdf runtime-dependency program check.
+       Split into two macros: one (`GROFF_CHECK_GROPDF_PROGRAMS`)
+       performs the check, the other (`GROFF_GROPDF_PROGRAM_NOTICE`)
+       issues a notice at the end of the configuration process if at
+       least one program was not found.  Rename `docnote` shell
+       variable to `gropdf_notice`.  Tighten wording of notice.  Drop
+       unused `make_install_pdfdoc` and `make_uninstall_pdfdoc` shell
+       variables.
+
 2022-05-20  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        Handle missing programs required at runtime by grohtml more
diff --git a/configure.ac b/configure.ac
index de79302a..3a878b68 100644
--- a/configure.ac
+++ b/configure.ac
@@ -164,7 +164,7 @@ GROFF_TMAC
 GROFF_WITH_COMPATIBILITY_WRAPPERS
 GROFF_TARGET_PATH_SEPARATOR
 GROFF_CHECK_GROHTML_PROGRAMS
-GROFF_PDFDOC_PROGRAMS
+GROFF_CHECK_GROPDF_PROGRAMS
 GROFF_PNMTOOLS_CAN_BE_QUIET
 GROFF_PNMTOPS_NOSETPAGE
 GROFF_MAKE_RM
@@ -198,7 +198,7 @@ AM_CONDITIONAL([MAKE_DONT_HAVE_RM], [test 
"$groff_is_rm_defined" = no])
 AM_CONDITIONAL([USEPROGRAMPREFIX], [test "$g" = g])
 
 AM_CONDITIONAL([USE_GROHTML], [test "$use_grohtml" = yes])
-AM_CONDITIONAL([BUILD_PDFDOC], [test -n "$make_pdfdoc"])
+AM_CONDITIONAL([USE_GROPDF], [test "$use_gropdf" = yes])
 AM_CONDITIONAL([USE_GROFF_ALLOCATOR], [test "$groff_use_own_allocator" = yes])
 AM_CONDITIONAL([HAVE_PDFTOOLS], [test "$groff_have_pdftools" = yes ])
 AM_CONDITIONAL([HAVE_TEXI2DVI], [test "$groff_have_texi2dvi" = yes ])
@@ -236,3 +236,4 @@ GROFF_URW_FONTS_CHECK
 GROFF_UCHARDET_CHECK
 GROFF_GHOSTSCRIPT_VERSION_NOTICE
 GROFF_GROHTML_PROGRAM_NOTICE
+GROFF_GROPDF_PROGRAM_NOTICE
diff --git a/contrib/mom/ChangeLog b/contrib/mom/ChangeLog
index 4fe6387f..e87d8811 100644
--- a/contrib/mom/ChangeLog
+++ b/contrib/mom/ChangeLog
@@ -1,3 +1,7 @@
+2022-05-20  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       * mom.am: Rename `BUILD_PDFDOC` to `USE_GROPDF`.
+
 2022-05-01  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        * mom.am ($(MOMPROCESSEDEXAMPLEFILES)): Depend on new name for
diff --git a/contrib/mom/mom.am b/contrib/mom/mom.am
index eddc17d5..fc8feaf1 100644
--- a/contrib/mom/mom.am
+++ b/contrib/mom/mom.am
@@ -87,7 +87,7 @@ MOMEXAMPLEFILES=\
 momexampledir = $(exampledir)/mom
 dist_momexample_DATA = $(MOMEXAMPLEFILES)
 
-if BUILD_PDFDOC
+if USE_GROPDF
 MOMPROCESSEDEXAMPLEFILES = \
   contrib/mom/examples/letter.pdf \
   contrib/mom/examples/mom-pdf.pdf \
@@ -152,7 +152,7 @@ penguin.pdf:
 
 install-data-hook: install_mom
 install_mom:
-if BUILD_PDFDOC
+if USE_GROPDF
        for f in $(PDFDOCFILE); do \
          $(RM) $(DESTDIR)$(pdfdocdir)/$$f; \
          ln -s $(exampledir)/mom/$$f $(DESTDIR)$(pdfdocdir)/$$f; \
diff --git a/contrib/pdfmark/ChangeLog b/contrib/pdfmark/ChangeLog
index 0084a449..e42abc15 100644
--- a/contrib/pdfmark/ChangeLog
+++ b/contrib/pdfmark/ChangeLog
@@ -1,3 +1,7 @@
+2022-05-20  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       * pdfmark.am: Rename `BUILD_PDFDOC` to `USE_GROPDF`.
+
 2022-03-30  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        * pdfmark.am: Eliminate `PDFMARK_TFLAG` and `PDFMARK_PFLAG` Make
diff --git a/contrib/pdfmark/pdfmark.am b/contrib/pdfmark/pdfmark.am
index 8645323b..82bd4ff4 100644
--- a/contrib/pdfmark/pdfmark.am
+++ b/contrib/pdfmark/pdfmark.am
@@ -35,7 +35,7 @@ dist_pdfmarktmac_DATA = $(TMACFILES)
 # Files installed in $(pdfdocdir)
 PDFDOCFILES = \
   contrib/pdfmark/pdfmark.pdf
-if BUILD_PDFDOC
+if USE_GROPDF
 pdfmarkpdfdocdir = $(pdfdocdir)
 nodist_pdfmarkpdfdoc_DATA = $(PDFDOCFILES)
 MOSTLYCLEANFILES += $(PDFDOCFILES)
@@ -87,7 +87,7 @@ mostlyclean_pdfmark:
 
 uninstall_groffdirs: uninstall-pdfmark-hook
 uninstall-pdfmark-hook:
-if BUILD_PDFDOC
+if USE_GROPDF
        if test -d $(DESTDIR)$(pdfmarkpdfdocdir); then \
          rmdir $(DESTDIR)$(pdfmarkpdfdocdir); \
        fi
diff --git a/contrib/sboxes/ChangeLog b/contrib/sboxes/ChangeLog
index 198f7c77..6d90d65c 100644
--- a/contrib/sboxes/ChangeLog
+++ b/contrib/sboxes/ChangeLog
@@ -1,3 +1,7 @@
+2022-05-20  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       * sboxes.am: Rename `BUILD_PDFDOC` to `USE_GROPDF`.
+
 2022-05-01  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        * sboxes.am ($(sboxes_builddir)/msboxes.pdf): Depend on new name
diff --git a/contrib/sboxes/sboxes.am b/contrib/sboxes/sboxes.am
index 3c202fe1..cbab2a47 100644
--- a/contrib/sboxes/sboxes.am
+++ b/contrib/sboxes/sboxes.am
@@ -33,7 +33,7 @@ SBOXES_EXAMPLEFILES = $(sboxes_srcdir)/msboxes.ms.in
 sboxesotherdocdir = $(docdir)
 nodist_sboxesotherdoc_DATA = $(sboxes_builddir)/msboxes.ms
 
-if BUILD_PDFDOC
+if USE_GROPDF
 sboxespdfdocdir = $(pdfdocdir)
 nodist_sboxespdfdoc_DATA = $(sboxes_builddir)/msboxes.pdf
 endif
diff --git a/doc/doc.am b/doc/doc.am
index 2a6a08ee..cd427550 100644
--- a/doc/doc.am
+++ b/doc/doc.am
@@ -61,9 +61,11 @@ if USE_GROHTML
 PROCESSEDDOCFILES_HTML = \
   doc/pic.html
 endif
+if USE_GROPDF
 PROCESSEDDOCFILES_PDF = \
   doc/automake.pdf \
   doc/groff-man-pages.pdf
+endif
 PROCESSEDDOCFILES_PS = \
   doc/meref.ps \
   doc/meintro.ps \
@@ -89,7 +91,9 @@ if USE_GROHTML
 $(PROCESSEDDOCFILES_HTML): $(PROCESSEDFILES_DEPS_HTML)
 endif
 $(PROCESSEDDOCFILES_PS): $(PROCESSEDFILES_DEPS_PS)
+if USE_GROPDF
 $(PROCESSEDDOCFILES_PDF): $(PROCESSEDFILES_DEPS_PDF)
+endif
 $(PROCESSEDDOCFILES_TXT): $(PROCESSEDFILES_DEPS_TXT)
 
 otherdocdir = $(docdir)
@@ -101,7 +105,7 @@ EXTRA_DIST += $(DOCFILES_NOINST)
 # pdf doc, written in mom and therefore using contrib/mom/mom.am
 # definitions
 EXTRA_DIST += doc/automake.mom
-if BUILD_PDFDOC
+if USE_GROPDF
 docpdfdocdir = $(pdfdocdir)
 nodist_docpdfdoc_DATA = doc/automake.pdf
 endif
diff --git a/m4/groff.m4 b/m4/groff.m4
index ec404bdf..00fcc5e2 100644
--- a/m4/groff.m4
+++ b/m4/groff.m4
@@ -196,42 +196,48 @@ AC_DEFUN([GROFF_GROHTML_PROGRAM_NOTICE], [
   fi
 ])
 
-# To produce PDF docs, we need both awk and ghostscript.
+# gropdf needs awk and Ghostscript to have produced its font description
+# files.
 
-AC_DEFUN([GROFF_PDFDOC_PROGRAMS],
-  [make_pdfdoc=
-   make_install_pdfdoc=
-   make_uninstall_pdfdoc=
-   AC_REQUIRE([GROFF_AWK_PATH])
-   AC_REQUIRE([GROFF_GHOSTSCRIPT_PATH])
-
-   missing=""
-   test "$AWK" = missing && missing="'awk'"
-   test "$GHOSTSCRIPT" = missing && missing="$missing 'gs'"
-   if test -z "$missing"; then
-       make_pdfdoc=pdfdoc
-       make_install_pdfdoc=install_pdfdoc
-       make_uninstall_pdfdoc=uninstall_pdfdoc
-   else
-     plural=`set $missing; test $[#] -eq 2 && echo s`
-     test "$plural" = s \
-       && missing=`set $missing; echo "$[1] and $[2]"` \
-       || missing=`echo $missing`
+AC_DEFUN([GROFF_CHECK_GROPDF_PROGRAMS], [
+  use_gropdf=no
+  AC_REQUIRE([GROFF_AWK_PATH])
+  AC_REQUIRE([GROFF_GHOSTSCRIPT_PATH])
 
-     docnote=';
-  therefore, it will neither be possible to prepare, nor to install,
-  documentation and most of the examples in PDF format.'
+  missing=
+  test "$AWK" = missing && missing="'awk'"
+  test "$GHOSTSCRIPT" = missing && missing="$missing 'gs'"
+  if test -z "$missing"
+  then
+    use_gropdf=yes
+  else
+    plural=`set $missing; test $[#] -eq 2 && echo s`
+    if test "$plural" = s
+    then
+      missing=`set $missing; echo "$[1] and $[2]"`
+      verb=were
+    else
+      missing=`echo $missing`
+      verb=was
+    fi
 
-     AC_MSG_WARN([missing program$plural:
+  gropdf_notice="The program$plural $missing $verb not found in \
+\$PATH.
 
-  The program$plural $missing cannot be found in the PATH.
+  Consequently, groff's PDF output driver, 'gropdf', will not work
+  properly.  It will not be possible to prepare or install
+  groff-generated documentation in PDF.
+"
+  fi
+  AC_SUBST([use_gropdf])
+])
 
-  Consequently, groff's PDF formatter (pdfroff) will not work properly$docnote
-     ])
-   fi
-   AC_SUBST([make_pdfdoc])
-   AC_SUBST([make_install_pdfdoc])
-   AC_SUBST([make_uninstall_pdfdoc])])
+AC_DEFUN([GROFF_GROPDF_PROGRAM_NOTICE], [
+  if test "$use_gropdf" = no
+  then
+    AC_MSG_NOTICE([$gropdf_notice])
+  fi
+])
 
 # Option to configure path to URW fonts
 AC_DEFUN([GROFF_URW_FONTS_PATH],



reply via email to

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