diff options
authorAlessio Vanni <>2021-11-24 21:21:32 +0100
committerAlessio Vanni <>2021-11-24 21:21:32 +0100
commit0bd99177d2424a76bcf26b5347bfe8ee568348e8 (patch)
parentf38383e58c2286531359d1b7755e5cb4952543b2 (diff)
-also check for LaTeX packages used by gnunet-bcddev/vanni/bcd-new
Just checking if the command is available is not enough; for example, some people might not have TikZ installed, a package required to draw the logo on the business cards.
2 files changed, 47 insertions, 3 deletions
diff --git a/ b/
index 6ad98cfc2..840bc48d3 100644
--- a/
+++ b/
@@ -265,9 +265,11 @@ AS_IF([test -x "$AWK_BINARY"],
[AC_DEFINE([HAVE_AWK], [1], [Define to 1 if awk is available])],
[AC_DEFINE([HAVE_AWK], [0], [Define to 1 if awk is available])])
-# check for pdflatex to build gnunet-bcd
-AC_CHECK_PROG([PDFLATEX_BINARY], [pdflatex], [true], [false])
+# check for some LaTeX packages used by gnunet-bcd
+CHECK_LATEX_PACKAGE([QR Code], [qrcode])
+CHECK_LATEX_PACKAGE([Labels], [labels])
[AS_HELP_STRING([--with-gnunet-logread], [Install gnunet-logread])],
diff --git a/m4/check-latex-package.m4 b/m4/check-latex-package.m4
new file mode 100644
index 000000000..7b7861134
--- /dev/null
+++ b/m4/check-latex-package.m4
@@ -0,0 +1,42 @@
+dnl Tries to compile a small LaTeX document to see if the requested package is
+dnl available to be used with \usepackage.
+dnl The result will be cached in the ac_cv_tex_PACKAGE-NAME variable.
+dnl This macro also checks for pdflatex as in AC_CHECK_PROGS and the result
+dnl is made available in the PDFLATEX_BINARY variable (all capitals like that.)
+dnl FEATURE-NAME is one or more words to identify the check;
+dnl PACKAGE-NAME is the package as it appears in the \usepackage statement
+dnl ACTION-IF-FOUND (optional) commands to execute if the package is installed
+dnl ACTION-IF-NOT-FOUND (optional) the inverse of ACTION-IF-FOUND
+[AC_CHECK_PROGS([PDFLATEX_BINARY], [pdflatex], [no])
+ AS_IF([test "x$ac_cv_prog_PDFLATEX_BINARY" = "xno"],
+ [m4_if([$4], ,:,[$4])],
+ [AC_CACHE_CHECK([for the $1 package for LaTeX], [AS_TR_SH([ac_cv_tex_][$2])],
+ [cat <<EOF > conftest.tex
+ "$ac_cv_prog_PDFLATEX_BINARY" conftest.tex 1>/dev/null 2>&1
+ AS_IF([test "x$?" = "x0"],
+ [AS_VAR_SET([AS_TR_SH([ac_cv_tex_][$2])], [yes])],
+ [AS_VAR_SET([AS_TR_SH([ac_cv_tex_][$2])], [no])])])
+ AS_VAR_IF([AS_TR_SH([ac_cv_tex_][$2])], [xyes],
+ [m4_if([$3], ,:,[$3])],
+ [m4_if([$4], ,:,[$4])])])