diff options
author | Alessio Vanni <vannilla@firemail.cc> | 2021-11-24 21:21:32 +0100 |
---|---|---|
committer | Alessio Vanni <vannilla@firemail.cc> | 2021-11-24 21:21:32 +0100 |
commit | 0bd99177d2424a76bcf26b5347bfe8ee568348e8 (patch) | |
tree | 967868de686d524a2bbd7283cf013a129d48870f /m4/check-latex-package.m4 | |
parent | f38383e58c2286531359d1b7755e5cb4952543b2 (diff) | |
download | gnunet-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/check-latex-package.m4')
-rw-r--r-- | m4/check-latex-package.m4 | 42 |
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 @@ | |||
1 | dnl | ||
2 | dnl CHECK_LATEX_PACKAGE(FEATURE-NAME, | ||
3 | dnl PACKAGE-NAME, | ||
4 | dnl ACTION-IF-FOUND, | ||
5 | dnl ACTION-IF-NOT-FOUND) | ||
6 | dnl | ||
7 | dnl Tries to compile a small LaTeX document to see if the requested package is | ||
8 | dnl available to be used with \usepackage. | ||
9 | dnl | ||
10 | dnl The result will be cached in the ac_cv_tex_PACKAGE-NAME variable. | ||
11 | dnl | ||
12 | dnl This macro also checks for pdflatex as in AC_CHECK_PROGS and the result | ||
13 | dnl is made available in the PDFLATEX_BINARY variable (all capitals like that.) | ||
14 | dnl | ||
15 | dnl FEATURE-NAME is one or more words to identify the check; | ||
16 | dnl PACKAGE-NAME is the package as it appears in the \usepackage statement | ||
17 | dnl ACTION-IF-FOUND (optional) commands to execute if the package is installed | ||
18 | dnl ACTION-IF-NOT-FOUND (optional) the inverse of ACTION-IF-FOUND | ||
19 | dnl | ||
20 | AC_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} | ||
30 | Hello | ||
31 | \\end{document} | ||
32 | EOF | ||
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 | ||