groff-commit
[Top][All Lists]
Advanced

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

[groff] 01/01: Skip hdtbl and mom tests if needed config is missing.


From: Bertrand Garrigues
Subject: [groff] 01/01: Skip hdtbl and mom tests if needed config is missing.
Date: Tue, 4 Dec 2018 19:12:09 -0500 (EST)

bgarrigues pushed a commit to branch master
in repository groff.

commit 2660afe9d4f8dcf087213c36656acf75f54a24f9
Author: Bertrand Garrigues <address@hidden>
Date:   Wed Dec 5 01:11:01 2018 +0100

    Skip hdtbl and mom tests if needed config is missing.
    
    * contrib/hdtbl/examples/test-hdtbl.sh.in: exit 77 (indicates
    automake to skip the result) if 'gs' is missing.
    
    * contrib/hdtbl/hdtbl.am: flag correctly test program generation.
    
    * contrib/mom/examples/test-mom.sh.in: exit 77 if URW fonts are
    not available.
    
    * contrib/mom/mom.am: distribute inconditionnally test-mom.in.
    
    * m4/groff.m4 (GROFF_URW_FONTS): check if 'awk' and 'gs' are
    available, and replace non-portable 'grep' command by awk script.
---
 ChangeLog                               | 17 ++++++++++++++
 contrib/hdtbl/examples/test-hdtbl.sh.in |  6 +++++
 contrib/hdtbl/hdtbl.am                  |  3 ++-
 contrib/mom/examples/test-mom.sh.in     |  7 ++++++
 contrib/mom/mom.am                      |  3 ++-
 m4/groff.m4                             | 41 +++++++++++++++++++--------------
 6 files changed, 58 insertions(+), 19 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 1bebd08..ff44953 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2018-12-05  Bertrand Garrigues <address@hidden>
+
+       Skip hdtbl and mom tests if needed config is missing.
+
+       * contrib/hdtbl/examples/test-hdtbl.sh.in: exit 77 (indicates
+       automake to skip the result) if 'gs' is missing.
+
+       * contrib/hdtbl/hdtbl.am: flag correctly test program generation.
+
+       * contrib/mom/examples/test-mom.sh.in: exit 77 if URW fonts are
+       not available.
+
+       * contrib/mom/mom.am: distribute inconditionnally test-mom.in.
+
+       * m4/groff.m4 (GROFF_URW_FONTS): check if 'awk' and 'gs' are
+       available, and replace non-portable 'grep' command by awk script.
+
 2018-12-01  Colin Watson  <address@hidden>
 
        Fix error handling in tests of mom examples
diff --git a/contrib/hdtbl/examples/test-hdtbl.sh.in 
b/contrib/hdtbl/examples/test-hdtbl.sh.in
index 0f6cd6f..5e81bf7 100644
--- a/contrib/hdtbl/examples/test-hdtbl.sh.in
+++ b/contrib/hdtbl/examples/test-hdtbl.sh.in
@@ -24,6 +24,12 @@
 builddir="@abs_top_builddir@"
 gs_program="@GHOSTSCRIPT@"
 ret=0
+
+if test "$gs_program" = "missing"; then
+   echo "ghostscript program missing, can't check hdtbl examples"
+   exit 77
+fi
+
 # $1 file, $2 expected number of pages
 check_number_pages()
 {
diff --git a/contrib/hdtbl/hdtbl.am b/contrib/hdtbl/hdtbl.am
index 6af1488..3537aa6 100644
--- a/contrib/hdtbl/hdtbl.am
+++ b/contrib/hdtbl/hdtbl.am
@@ -101,6 +101,7 @@ EXTRA_DIST += \
   contrib/hdtbl/hdtbl.tmac-u \
   contrib/hdtbl/hdmisc.tmac-u
 
+if BUILD_EXAMPLES
 hdtbl_TESTS = contrib/hdtbl/examples/test-hdtbl.sh
 TESTS += $(hdtbl_TESTS)
 contrib/hdtbl/examples/test-hdtbl.sh: $(top_builddir)/config.status \
@@ -109,8 +110,8 @@ contrib/hdtbl/examples/test-hdtbl.sh: 
$(top_builddir)/config.status \
            -e "s|address@hidden@]|$(GHOSTSCRIPT)|g" \
                $(top_srcdir)/contrib/hdtbl/examples/test-hdtbl.sh.in > $@
        chmod +x $@
-
 MOSTLYCLEANFILES += $(hdtbl_TESTS)
+endif
 
 # Rule to generate ps and roff files
 SUFFIXES += .roff .in .ps
diff --git a/contrib/mom/examples/test-mom.sh.in 
b/contrib/mom/examples/test-mom.sh.in
index ce47a02..0841b37 100644
--- a/contrib/mom/examples/test-mom.sh.in
+++ b/contrib/mom/examples/test-mom.sh.in
@@ -19,6 +19,7 @@
 #
 
 builddir="@abs_top_builddir@"
+have_urw_fonts="@groff_have_urw_fonts@"
 examplesdir="$builddir/contrib/mom/examples"
 ret=0
 list="
@@ -29,6 +30,12 @@ list="
   slide-demo.pdf
   typesetting.pdf
   "
+
+if test "$have_urw_fonts" != "yes"; then
+    echo "No URW fonts, mom examples cannot be correctly generated"
+    exit 77
+fi
+
 # $1: pdf file
 # $2: expected number of pages
 check_number_pages()
diff --git a/contrib/mom/mom.am b/contrib/mom/mom.am
index b17f1b3..57ae357 100644
--- a/contrib/mom/mom.am
+++ b/contrib/mom/mom.am
@@ -111,12 +111,13 @@ TESTS += $(mom_TESTS)
 contrib/mom/examples/tests-mom.sh: $(top_builddir)/config.status \
        $(MOMPROCESSEDEXAMPLEFILES)  
$(top_srcdir)/contrib/mom/examples/test-mom.sh.in
        sed -e "s|address@hidden@]|$(abs_top_builddir)|g" \
+            -e "s|address@hidden@]|$(groff_have_urw_fonts)|g" \
                $(top_srcdir)/contrib/mom/examples/test-mom.sh.in > $@
        chmod +x $@
 MOSTLYCLEANFILES += $(mom_TESTS)
-EXTRA_DIST += contrib/mom/examples/test-mom.sh.in
 endif
 endif
+EXTRA_DIST += contrib/mom/examples/test-mom.sh.in
 
 # For this list of files we add a symlink from $(exampledir)/mom to 
$(pdfdocdir)
 PDFDOCFILE = mom-pdf.pdf
diff --git a/m4/groff.m4 b/m4/groff.m4
index 1862dd7..75aa3e2 100644
--- a/m4/groff.m4
+++ b/m4/groff.m4
@@ -343,24 +343,31 @@ AC_DEFUN([GROFF_URW_FONTS_PATH],
 # expect them), or in the custom path passed to configure.
 AC_DEFUN([GROFF_URW_FONTS],
   [AC_MSG_CHECKING([whether URW fonts in pfb format are available])
-  _list_paths=`gs -h | grep -A 16 "Search path" | grep "^[ ]" | tr : ' ' `
-  _list_paths="$_list_paths /usr/share/fonts/type1/gsfonts/ \
+   AC_REQUIRE([GROFF_AWK_PATH])
+   AC_REQUIRE([GROFF_GHOSTSCRIPT_PATH])
+   groff_have_urw_fonts=no
+   if test "$AWK" = "missing" -o "$GHOSTSCRIPT" = "missing"; then
+     AC_MSG_WARN([awk and gs are required, can't look for URW fonts])
+   else
+     _list_paths=`$GHOSTSCRIPT -h | $AWK 'BEGIN { found = 0 } /Search path:/ { 
found = 1 } /^[ ]*\// { print $'0' }'| tr : ' '`
+     _list_paths="$_list_paths /usr/share/fonts/type1/gsfonts/ \
                /opt/local/share/fonts/urw-fonts/"
-  if test -n "$urwfontsdir"; then
-    _list_paths="$ _list_paths $urwfontsdir"
-  fi
-  groff_have_urw_fonts=no
-  for k in $_list_paths; do
-    if test -f $k/a010013l.pfb; then
-      AC_MSG_RESULT([found in $k])
-      groff_have_urw_fonts=yes
-      break
-    fi
-  done 
-  if test $groff_have_urw_fonts = no; then
-    AC_MSG_RESULT([no])
-  fi
-  ])
+     if test -n "$urwfontsdir"; then
+       _list_paths="$ _list_paths $urwfontsdir"
+     fi
+     for k in $_list_paths; do
+       if test -f $k/a010013l.pfb; then
+         AC_MSG_RESULT([found in $k])
+         groff_have_urw_fonts=yes
+         break
+       fi
+     done
+   fi
+   if test $groff_have_urw_fonts = no; then
+     AC_MSG_RESULT([no])
+   fi
+   AC_SUBST([groff_have_urw_fonts])
+   ])
 
 # Warning if URW fonts were not found
 AC_DEFUN([GROFF_URW_FONTS_CHECK],



reply via email to

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