gbranden pushed a commit to branch master
in repository groff.
commit 2d71ea4cb3583385f3ff7c017a5bb6d5b0ae14dc
Author: G. Branden Robinson <[email protected]>
AuthorDate: Tue Jul 9 10:51:44 2024 -0500
[grohtml]: Fix Savannah #65961 (quieten pnmcrop).
[grohtml]: Pass `-blank-image=pass` to pnmcrop(1) if supported by the
installed version of Netpbm.
* m4/groff.m4 (GROFF_PNMTOOLS_CAN_BE_QUIET): Set up an Autoheader
template for the C/C++ preprocessor symbol `PNMCROP_PASS`. Report the
detected option (if any) as the result of this configuration test.
Get the expansion into the "config.h" file with `AC_DEFINE_UNQUOTED`.
* src/preproc/html/pre-html.cpp (imageList::createImage): Use the
preprocessor symbol.
Fixes <https://savannah.gnu.org/bugs/?65961>. Thanks to Bjarni Ingi
Gislason for the report.
Build-tested in Debian bookworm and bullseye environments. In the
former, the "netpbm" package lacks `-blank-image=pass` support, and the
latter has it.
---
ChangeLog | 16 ++++++++++++++++
m4/groff.m4 | 18 ++++++++++++++----
src/preproc/html/pre-html.cpp | 2 +-
3 files changed, 31 insertions(+), 5 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 548b17625..540e3456a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2024-07-09 G. Branden Robinson <[email protected]>
+
+ [grohtml]: Pass `-blank-image=pass` to pnmcrop(1) if supported
+ by the installed version of Netpbm.
+
+ * m4/groff.m4 (GROFF_PNMTOOLS_CAN_BE_QUIET): Set up an
+ Autoheader template for the C/C++ preprocessor symbol
+ `PNMCROP_PASS`. Report the detected option (if any) as the
+ result of this configuration test. Get the expansion into the
+ "config.h" file with `AC_DEFINE_UNQUOTED`.
+ * src/preproc/html/pre-html.cpp (imageList::createImage): Use
+ the preprocessor symbol.
+
+ Fixes <https://savannah.gnu.org/bugs/?65961>. Thanks to Bjarni
+ Ingi Gislason for the report.
+
2024-07-09 G. Branden Robinson <[email protected]>
Actually use the detected Netpbm option for quieting output in
diff --git a/m4/groff.m4 b/m4/groff.m4
index fd4545b8c..347091deb 100644
--- a/m4/groff.m4
+++ b/m4/groff.m4
@@ -447,16 +447,19 @@ AC_DEFUN([GROFF_URW_FONTS_NOTICE], [
])
-# Check whether the pnm tools accept the -quiet option.
+# See how to make Netpbm commands quiet where we need them to be.
-dnl Any macro that tests $pnmtools_quiet should AC_REQUIRE this.
+dnl Any macro that tests $pnmtools_quiet or $pnmcrop_pass should
+dnl AC_REQUIRE this.
AC_DEFUN([GROFF_PNMTOOLS_CAN_BE_QUIET], [
AC_REQUIRE([GROFF_CHECK_GROHTML_PROGRAMS])
AH_TEMPLATE([PNMTOOLS_QUIET], [Command-line option to quiet Netpnm.])
+ AH_TEMPLATE([PNMCROP_PASS], [Command-line option to quiet pnmcrop.])
pnmtools_quiet=
+ pnmcrop_pass=
if test "$use_grohtml" = yes
then
@@ -465,15 +468,22 @@ AC_DEFUN([GROFF_PNMTOOLS_CAN_BE_QUIET], [
then
pnmtools_quiet=-quiet
fi
- if test -n "$pnmtools_quiet"
+ if echo P2 2 2 255 0 1 2 0 | pnmcrop "$pnmtools_quiet" \
+ -blank-image=pass > /dev/null 2>&1
then
- AC_MSG_RESULT([$pnmtools_quiet])
+ pnmcrop_pass=-blank-image=pass
+ fi
+ if test -n "$pnmtools_quiet$pnmcrop_pass"
+ then
+ AC_MSG_RESULT([$pnmtools_quiet $pnmcrop_pass])
else
AC_MSG_RESULT([(none)])
fi
fi
AC_SUBST([pnmtools_quiet])
+ AC_SUBST([pnmcrop_pass])
AC_DEFINE_UNQUOTED([PNMTOOLS_QUIET], ["$pnmtools_quiet"])
+ AC_DEFINE_UNQUOTED([PNMCROP_PASS], ["$pnmcrop_pass"])
])
diff --git a/src/preproc/html/pre-html.cpp b/src/preproc/html/pre-html.cpp
index 751cba78e..90a93510e 100644
--- a/src/preproc/html/pre-html.cpp
+++ b/src/preproc/html/pre-html.cpp
@@ -1007,7 +1007,7 @@ void imageList::createImage(imageItem *i)
+ 1 + IMAGE_BORDER_PIXELS;
if (createPage(i->pageNo) == 0) {
s = make_string("pamcut%s %d %d %d %d < %s "
- "| pnmcrop%s " PNMTOOLS_QUIET
+ "| pnmcrop%s " PNMTOOLS_QUIET " " PNMCROP_PASS
"| pnmtopng%s " PNMTOOLS_QUIET " %s"
"> %s\n",
EXE_EXT,
_______________________________________________
Groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit