[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnunet] 08/09: -also check for LaTeX packages used by gnunet-bcd
From: |
gnunet |
Subject: |
[gnunet] 08/09: -also check for LaTeX packages used by gnunet-bcd |
Date: |
Thu, 25 Nov 2021 20:49:17 +0100 |
This is an automated email from the git hooks/post-receive script.
alessio-vanni pushed a commit to branch master
in repository gnunet.
commit 0bd99177d2424a76bcf26b5347bfe8ee568348e8
Author: Alessio Vanni <vannilla@firemail.cc>
AuthorDate: Wed Nov 24 21:21:32 2021 +0100
-also check for LaTeX packages used by gnunet-bcd
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.
---
configure.ac | 8 +++++---
m4/check-latex-package.m4 | 42 ++++++++++++++++++++++++++++++++++++++++++
2 files changed, 47 insertions(+), 3 deletions(-)
diff --git a/configure.ac b/configure.ac
index 6ad98cfc2..840bc48d3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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])
-AM_CONDITIONAL([HAVE_PDFLATEX], [$PDFLATEX_BINARY])
+# check for some LaTeX packages used by gnunet-bcd
+CHECK_LATEX_PACKAGE([TikZ], [tikz])
+CHECK_LATEX_PACKAGE([QR Code], [qrcode])
+CHECK_LATEX_PACKAGE([Labels], [labels])
+AM_CONDITIONAL([HAVE_PDFLATEX], [test "x$PDFLATEX_BINARY" != "xno"])
AC_ARG_WITH([gnunet-logread],
[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
+dnl CHECK_LATEX_PACKAGE(FEATURE-NAME,
+dnl PACKAGE-NAME,
+dnl ACTION-IF-FOUND,
+dnl ACTION-IF-NOT-FOUND)
+dnl
+dnl Tries to compile a small LaTeX document to see if the requested package is
+dnl available to be used with \usepackage.
+dnl
+dnl The result will be cached in the ac_cv_tex_PACKAGE-NAME variable.
+dnl
+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
+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
+dnl
+AC_DEFUN([CHECK_LATEX_PACKAGE],
+[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
+\\documentclass{article}
+\\usepackage{$2}
+\\begin{document}
+Hello
+\\end{document}
+EOF
+
+ "$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])])])
+])dnl
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [gnunet] branch master updated (63854ee52 -> a24bbd5b3), gnunet, 2021/11/25
- [gnunet] 04/09: -mallinfo is deprecated in favour of mallinfo2, gnunet, 2021/11/25
- [gnunet] 06/09: Fix gnunet-namestore's URI import, gnunet, 2021/11/25
- [gnunet] 02/09: Allow gnunet-qr to read codes from PNG pictures, gnunet, 2021/11/25
- [gnunet] 05/09: -do not build gnunet-bcd if pdflatex is missing, gnunet, 2021/11/25
- [gnunet] 08/09: -also check for LaTeX packages used by gnunet-bcd,
gnunet <=
- [gnunet] 03/09: Update configure.ac and a few macros used by it, gnunet, 2021/11/25
- [gnunet] 09/09: Merge branch 'dev/vanni/bcd-new', gnunet, 2021/11/25
- [gnunet] 01/09: Improve gnunet-bcd and update logo used in generated cards, gnunet, 2021/11/25
- [gnunet] 07/09: -accidentally broken uncrustify check, gnunet, 2021/11/25