Merge pull request #1406 from kugel-/for-upstream
[geany-mirror.git] / m4 / geany-docutils.m4
blob00c2584bd7281ea6655a6fa84bea71c8d176cb3e
1 dnl GEANY_CHECK_DOCUTILS
2 dnl Check for the tools used to generate documentation
3 dnl
4 AC_DEFUN([GEANY_CHECK_DOCUTILS],
6         GEANY_CHECK_DOCUTILS_HTML
7         GEANY_CHECK_DOCUTILS_PDF
8 ])
9 dnl
10 dnl GEANY_CHECK_DOCUTILS_HTML
11 dnl For HTML documentation generation
12 dnl
13 AC_DEFUN([GEANY_CHECK_DOCUTILS_HTML],
15         AC_REQUIRE([GEANY_CHECK_REVISION])
17         AS_IF([test -f "$srcdir/doc/geany.html"],
18                 [have_prebuilt_html_docs=yes],
19                 [have_prebuilt_html_docs=no])
21         dnl we require rst2html by default unless we don't build from Git
22         dnl and already have the HTML manual built in-tree
23         html_docs_default=yes
24         AS_IF([test "$REVISION" = "-1" && test "x$have_prebuilt_html_docs" = xyes],
25                 [html_docs_default=auto])
27         AC_ARG_ENABLE([html-docs],
28                 [AS_HELP_STRING([--enable-html-docs],
29                         [generate HTML documentation using rst2html [default=auto]])],
30                 [geany_enable_html_docs="$enableval"],
31                 [geany_enable_html_docs="$html_docs_default"])
32         AC_ARG_VAR([RST2HTML], [Path to Docutils rst2html executable])
33         AS_IF([test "x$geany_enable_html_docs" != "xno"],
34         [
35                 AC_PATH_PROGS([RST2HTML], [rst2html rst2html.py], [no])
36                 AS_IF([test "x$RST2HTML" != "xno"],
37                         [geany_enable_html_docs="yes"],
38                         [test "x$geany_enable_html_docs" = "xyes"],
39                         [AC_MSG_ERROR([Documentation enabled but rst2html not found.
40 You can explicitly disable building of the HTML manual with --disable-html-docs,
41 but you then may not have a local copy of the HTML manual.])],
42                         [geany_enable_html_docs="no"])
43         ])
44         AM_CONDITIONAL([WITH_RST2HTML], [test "x$geany_enable_html_docs" != "xno"])
45         AM_CONDITIONAL([INSTALL_HTML_DOCS], [test "x$geany_enable_html_docs" != "xno" ||
46                                              test "x$have_prebuilt_html_docs" = xyes])
47         GEANY_STATUS_ADD([Build HTML documentation], [$geany_enable_html_docs])
49 dnl
50 dnl GEANY_CHECK_DOCUTILS_PDF
51 dnl For PDF documentation generation
52 dnl
53 AC_DEFUN([GEANY_CHECK_DOCUTILS_PDF],
55         AC_ARG_ENABLE([pdf-docs],
56                 [AS_HELP_STRING([--enable-pdf-docs],
57                         [generate PDF documentation using rst2pdf [default=auto]])],
58                 [geany_enable_pdf_docs="$enableval"],
59                 [geany_enable_pdf_docs="auto"])
60         AC_ARG_VAR([RST2PDF], [Path to Docutils rst2pdf executable])
61         AS_IF([test "x$geany_enable_pdf_docs" != "xno"],
62         [
63                 AC_PATH_PROGS([RST2PDF], [rst2pdf rst2pdf.py], [no])
64                 AS_IF([test "x$RST2PDF" != "xno"],
65                         [geany_enable_pdf_docs="yes"],
66                         [test "x$geany_enable_pdf_docs" = "xyes"],
67                         [AC_MSG_ERROR([PDF documentation enabled but rst2pdf not found])],
68                         [geany_enable_pdf_docs="no"])
69         ])
70         AM_CONDITIONAL([WITH_RST2PDF], [test "x$geany_enable_pdf_docs" != "xno"])
71         GEANY_STATUS_ADD([Build PDF documentation], [$geany_enable_pdf_docs])