aboutsummaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
authorAlessio Vanni <vannilla@firemail.cc>2021-11-24 21:21:32 +0100
committerAlessio Vanni <vannilla@firemail.cc>2021-11-24 21:21:32 +0100
commit0bd99177d2424a76bcf26b5347bfe8ee568348e8 (patch)
tree967868de686d524a2bbd7283cf013a129d48870f /m4
parentf38383e58c2286531359d1b7755e5cb4952543b2 (diff)
downloadgnunet-0bd99177d2424a76bcf26b5347bfe8ee568348e8.tar.gz
gnunet-0bd99177d2424a76bcf26b5347bfe8ee568348e8.zip
-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.
Diffstat (limited to 'm4')
-rw-r--r--m4/check-latex-package.m442
1 files changed, 42 insertions, 0 deletions
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 @@
1dnl
2dnl CHECK_LATEX_PACKAGE(FEATURE-NAME,
3dnl PACKAGE-NAME,
4dnl ACTION-IF-FOUND,
5dnl ACTION-IF-NOT-FOUND)
6dnl
7dnl Tries to compile a small LaTeX document to see if the requested package is
8dnl available to be used with \usepackage.
9dnl
10dnl The result will be cached in the ac_cv_tex_PACKAGE-NAME variable.
11dnl
12dnl This macro also checks for pdflatex as in AC_CHECK_PROGS and the result
13dnl is made available in the PDFLATEX_BINARY variable (all capitals like that.)
14dnl
15dnl FEATURE-NAME is one or more words to identify the check;
16dnl PACKAGE-NAME is the package as it appears in the \usepackage statement
17dnl ACTION-IF-FOUND (optional) commands to execute if the package is installed
18dnl ACTION-IF-NOT-FOUND (optional) the inverse of ACTION-IF-FOUND
19dnl
20AC_DEFUN([CHECK_LATEX_PACKAGE],
21[AC_CHECK_PROGS([PDFLATEX_BINARY], [pdflatex], [no])
22
23 AS_IF([test "x$ac_cv_prog_PDFLATEX_BINARY" = "xno"],
24 [m4_if([$4], ,:,[$4])],
25 [AC_CACHE_CHECK([for the $1 package for LaTeX], [AS_TR_SH([ac_cv_tex_][$2])],
26 [cat <<EOF > conftest.tex
27\\documentclass{article}
28\\usepackage{$2}
29\\begin{document}
30Hello
31\\end{document}
32EOF
33
34 "$ac_cv_prog_PDFLATEX_BINARY" conftest.tex 1>/dev/null 2>&1
35 AS_IF([test "x$?" = "x0"],
36 [AS_VAR_SET([AS_TR_SH([ac_cv_tex_][$2])], [yes])],
37 [AS_VAR_SET([AS_TR_SH([ac_cv_tex_][$2])], [no])])])
38
39 AS_VAR_IF([AS_TR_SH([ac_cv_tex_][$2])], [xyes],
40 [m4_if([$3], ,:,[$3])],
41 [m4_if([$4], ,:,[$4])])])
42])dnl