gbranden pushed a commit to branch master
in repository groff.

commit 1e4d06f1dc9fd53dbc790bc7fc71f12021b051ec
Author: G. Branden Robinson <[email protected]>
AuthorDate: Tue May 24 12:51:21 2022 -0500

    m4/groff.m4: Improve shell code portability.
    
    * m4/groff.m4 (GROFF_PROG_YACC, GROFF_URW_FONTS_CHECK,
      GROFF_WITH_COMPATIBILITY_WRAPPERS, GROFF_UCHARDET_NOTICE): Improve
      shell code portability.  Per the GNU Autoconf manual, "The -a, -o,
      '(', and ')' operands are not present in all implementations, and have
      been marked obsolete by Posix 2008.  ...portable uses of test should
      never have more than four arguments, and scripts should use shell
      constructs like '&&' and '||' instead."
---
 ChangeLog   | 11 +++++++++++
 m4/groff.m4 | 14 +++++++-------
 2 files changed, 18 insertions(+), 7 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 5823093e..cc882e4d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2022-05-24  G. Branden Robinson <[email protected]>
+
+       * m4/groff.m4 (GROFF_PROG_YACC, GROFF_URW_FONTS_CHECK,
+       GROFF_WITH_COMPATIBILITY_WRAPPERS, GROFF_UCHARDET_NOTICE):
+       Improve shell code portability.  Per the GNU Autoconf manual,
+       "The -a, -o, '(', and ')' operands are not present in all
+       implementations, and have been marked obsolete by Posix 2008.
+       ...portable uses of test should never have more than four
+       arguments, and scripts should use shell constructs like '&&' and
+       '||' instead."
+
 2022-05-24  G. Branden Robinson <[email protected]>
 
        * src/roff/groff/groff.1.man (Installation directories): Don't
diff --git a/m4/groff.m4 b/m4/groff.m4
index 5ad62803..36b2078a 100644
--- a/m4/groff.m4
+++ b/m4/groff.m4
@@ -72,7 +72,7 @@ AC_DEFUN([GROFF_PRINT], [
 
 AC_DEFUN([GROFF_PROG_YACC], [
   AC_CHECK_PROGS([YACC], [byacc 'bison -y' yacc], [missing])
-  if test "$YACC" = missing -a -d "$srcdir"/.git
+  if test "$YACC" = missing && test -d "$srcdir"/.git
   then
     AC_MSG_ERROR([could not find 'byacc', 'bison', or 'yacc'], 1)
   fi
@@ -289,7 +289,7 @@ AC_DEFUN([GROFF_URW_FONTS_CHECK], [
   AC_REQUIRE([GROFF_AWK_PATH])
   AC_REQUIRE([GROFF_GHOSTSCRIPT_PATH])
   groff_have_urw_fonts=no
-  if test "$AWK" != missing -a "$GHOSTSCRIPT" != missing
+  if test "$AWK" != missing && test "$GHOSTSCRIPT" != missing
   then
     AC_MSG_CHECKING([for URW fonts in Type 1/PFB format])
     _list_paths=`$GHOSTSCRIPT -h | $AWK 'BEGIN { found = 0 } /Search path:/ { 
found = 1 } /^[ ]*\// { print $'0' }'| tr : ' '`
@@ -1177,10 +1177,10 @@ AC_DEFUN([GROFF_WITH_COMPATIBILITY_WRAPPERS],
     [compatibility_wrappers="$withval"],
     [compatibility_wrappers="check"])
 
-    if test "$compatibility_wrappers" != check  -a \
-            "$compatibility_wrappers" != yes    -a \
-            "$compatibility_wrappers" != no     -a \
-            "$compatibility_wrappers" != manual
+    if    test "$compatibility_wrappers" != check \
+       && test "$compatibility_wrappers" != yes   \
+       && test "$compatibility_wrappers" != no    \
+       && test "$compatibility_wrappers" != manual
     then
          AC_MSG_WARN([Invalid '--with-compatibility-wrappers' argument: 
'$compatibility_wrappers' - assuming 'check' requested.])
          compatibility_wrappers="check"
@@ -1707,7 +1707,7 @@ less functional])
 ])
 
 AC_DEFUN([GROFF_UCHARDET_NOTICE], [
-  if test "$groff_have_uchardet" = no -a "$with_uchardet" != no
+  if test "$groff_have_uchardet" = no && test "$with_uchardet" != no
   then
     AC_MSG_NOTICE([The uchardet library was not found.
 

_______________________________________________
Groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit

Reply via email to