gbranden pushed a commit to branch master
in repository groff.
commit 3a4cff5804b28ceec69404ef0b075641d3453bb6
Author: G. Branden Robinson <[email protected]>
AuthorDate: Wed Aug 16 03:06:17 2023 -0500
m4/groff.m4: Report how paper format is inferred.
* m4/groff.m4 (GROFF_PAGE): Slightly refactor, and help users to figure
out how the "configure" script decided upon the paper format it did by
supplementing the `AC_MSG_RESULT` message. If not falling back to the
"letter" default or honoring a command-line setting (e.g.,
"./configure PAGE=a4"), report which file or command was used to infer
the paper locale. Apply DRY principle by using shell variables more.
Prompted by discussion with Damian McGuckin on the groff list.
<https://lists.gnu.org/archive/html/groff/2023-07/msg00072.html>
---
ChangeLog | 11 +++++++++++
m4/groff.m4 | 29 +++++++++++++++++++++++------
2 files changed, 34 insertions(+), 6 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 8a685b37d..203f90d75 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,17 @@
* configure.ac: Include paper format in configuration report.
+ * m4/groff.m4 (GROFF_PAGE): Slightly refactor, and help users to
+ figure out how the "configure" script decided upon the paper
+ format it did by supplementing the `AC_MSG_RESULT` message. If
+ not falling back to the "letter" default or honoring a
+ command-line setting (e.g., "./configure PAGE=a4"), report which
+ file or command was used to infer the paper locale. Apply DRY
+ principle by using shell variables more.
+
+ Prompted by discussion with Damian McGuckin on the groff list.
+ <https://lists.gnu.org/archive/html/groff/2023-07/msg00072.html>
+
2023-08-12 G. Branden Robinson <[email protected]>
Our "Makefile.am" defines an `RM` macro if make(1) itself does
diff --git a/m4/groff.m4 b/m4/groff.m4
index ea357855b..ba50f404b 100644
--- a/m4/groff.m4
+++ b/m4/groff.m4
@@ -972,13 +972,17 @@ AC_DEFUN([GROFF_BROKEN_SPOOLER_FLAGS],
AC_DEFUN([GROFF_PAGE], [
AC_MSG_CHECKING([default paper format])
+ whence=
groff_prefix=$prefix
test "$prefix" = NONE && groff_prefix=$ac_default_prefix
- if test -z "$PAGE" && test -r /etc/papersize
+ papersize=/etc/papersize
+ if test -z "$PAGE" && test -r "$papersize"
then
sedexpr='s/#.*//;s/[ \t]\+/ /;s/ \+$//;s/^ \+//;/^$/d;p'
- PAGE=`sed -n "$sedexpr" /etc/papersize`
+ PAGE=`sed -n "$sedexpr" "$papersize"`
+ test -n "$PAGE" && whence=$papersize
fi
+
if test -z "$PAGE"
then
descfile=
@@ -1008,24 +1012,29 @@ AC_DEFUN([GROFF_PAGE], [
then
PAGE=A4
fi
+ test -n "$PAGE" && whence=$descfile
fi
fi
if test -z "$PAGE"
then
+ resolvconf=/etc/resolv.conf
domains=
- if test -r /etc/resolv.conf
+ if test -r "$resolvconf"
then
sedexpr='s/#.*//;s/[ \t]\+/ /;s/ \+$//;s/^ \+//;/^$/d;
/^\(domain\|search\)/!d;s/\(domain\|search\) //;p'
- domains=`sed -n "$sedexpr" /etc/resolv.conf`
+ domains=`sed -n "$sedexpr" "$resolvconf"`
fi
+ test -n "$domains" && whence=$resolvconf
if test -z "$domains"
then
domains=`(domainname) 2>/dev/null | tr -d '+'`
+ test -n "$domains" && whence="'domainname' command"
if test -z "$domains" || test "$domains" = '(none)'
then
domains=`(hostname) 2>/dev/null | grep '\.'`
+ test -n "$domains" && whence="'hostname' command"
fi
fi
# resolv.conf's "search" directive might return multiple domains.
@@ -1042,8 +1051,16 @@ AC_DEFUN([GROFF_PAGE], [
done
fi
- test -n "$PAGE" || PAGE=letter
- AC_MSG_RESULT([$PAGE])
+ message=
+ test -n "$PAGE" && test -n "$whence" \
+ && message=" (inferred from $whence)"
+
+ if test -z "$PAGE"
+ then
+ PAGE=letter
+ fi
+
+ AC_MSG_RESULT([$PAGE$message])
AC_SUBST([PAGE])
])
_______________________________________________
Groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit