Check for makeinfo during configuration and if found, generate and
install documentation in Info format.
---
 .gitignore          |  1 +
 doc/build.rst       |  3 +++
 doc/conf.py         | 10 ++++++++++
 doc/meson.build     | 13 ++++++++++++-
 meson.build         |  1 +
 scripts/make-doc.sh |  6 ++++++
 6 files changed, 33 insertions(+), 1 deletion(-)
diff --git a/.gitignore b/.gitignore
index 153c1973..808ba0ec 100644
--- a/.gitignore
+++ b/.gitignore
@@ -48,6 +48,7 @@
 /doc/doxyxml
 /doc/html
 /doc/kresd.8
+/doc/texinfo
 /install-sh
 /libkres.pc
 /libtool
diff --git a/doc/build.rst b/doc/build.rst
index 20d75ca8..e844b604 100644
--- a/doc/build.rst
+++ b/doc/build.rst
@@ -51,6 +51,8 @@ Resolver:
    "Doxygen_", "``documentation``", "Generating API
documentation."
    "Sphinx_ and sphinx_rtd_theme_", "``documentation``",
"Building this
    HTML/PDF documentation."
+   "Texinfo_", "``documentation``", "Generating this
documentation in Info
+   format."
    "breathe_", "``documentation``", "Exposing Doxygen API doc to
Sphinx."
    "libsystemd_", "``daemon``", "Systemd watchdog support."
    "libprotobuf_ 3.0+", "``modules/dnstap``", "Protocol Buffers
support for
@@ -288,6 +290,7 @@ For development, it's possible to build the container directly
from your git tre
 .. _breathe: 
https://github.com/michaeljones/breathe
 .. _Sphinx: 
http://sphinx-doc.org/
 .. _sphinx_rtd_theme: 
https://pypi.python.org/pypi/sphinx_rtd_theme
+.. _Texinfo: 
https://www.gnu.org/software/texinfo/
 .. _pkg-config: 
https://www.freedesktop.org/wiki/Software/pkg-config/
 .. _libknot: 
https://gitlab.nic.cz/knot/knot-dns
 .. _cmocka: 
https://cmocka.org/
diff --git a/doc/conf.py b/doc/conf.py
index fcc1c99c..7ebef5b1 100644
--- a/doc/conf.py
+++ b/doc/conf.py
@@ -83,3 +83,13 @@ man_pages = [
     ('index', 'libkres', u'libkres documentation',
      [u'CZ.NIC Labs'], 1)
 ]
+
+# -- Options for Texinfo output ------------------------------------------------
+
+# Grouping the document tree into Texinfo files. List of tuples
+# (source start file, target name, title, author,
+#  dir menu entry, description, category)
+texinfo_documents = [
+    ('index', 'knot-resolver', u'Knot Resolver', u'CZ.NIC
Labs',
+     'Knot Resolver', 'Caching DNS resolver.', 'Network
services'),
+]
diff --git a/doc/meson.build b/doc/meson.build
index cfb5a55e..360cdfd7 100644
--- a/doc/meson.build
+++ b/doc/meson.build
@@ -19,7 +19,7 @@ man_kresd = configure_file(
 install_man(man_kresd)
-# html documentation
+# html and info documentation
 if get_option('doc') == 'enabled'
   message('--- doc dependencies ---')
   doxygen = find_program('doxygen')
@@ -27,6 +27,7 @@ if get_option('doc') == 'enabled'
   if not sphinx_build.found()
     sphinx_build = find_program('sphinx-build')
   endif
+  makeinfo = find_program('makeinfo', required: false)
   # python dependencies: breathe, sphinx_rtd_theme
   python_breathe = run_command('python3', '-c', 'import breathe')
@@ -54,6 +55,16 @@ if get_option('doc') == 'enabled'
     join_paths(meson.current_source_dir(), 'html'),
     install_dir: doc_dir,
   )
+
+  if makeinfo.found()
+    # install info docs
+    install_subdir(
+      join_paths(meson.current_source_dir(), 'texinfo'),
+      strip_directory: true,
+      exclude_files: ['Makefile', 'knot-resolver.texi'],
+      install_dir: info_dir,
+    )
+  endif
 endif
 make_doc = find_program('../scripts/make-doc.sh')
diff --git a/meson.build b/meson.build
index 4eb17169..7584d591 100644
--- a/meson.build
+++ b/meson.build
@@ -47,6 +47,7 @@ endif
 prefix = get_option('prefix')
 data_dir = join_paths(prefix, get_option('datadir'), 'knot-resolver')
 doc_dir = join_paths(prefix, get_option('datadir'), 'doc',
'knot-resolver')
+info_dir = join_paths(prefix, get_option('datadir'), 'info')
 examples_dir = join_paths(doc_dir, 'examples')
 etc_dir = join_paths(prefix, get_option('sysconfdir'), 'knot-resolver')
 lib_dir = join_paths(prefix, get_option('libdir'), 'knot-resolver')
diff --git a/scripts/make-doc.sh b/scripts/make-doc.sh
index 9d476121..0abd9254 100755
--- a/scripts/make-doc.sh
+++ b/scripts/make-doc.sh
@@ -15,3 +15,9 @@ set -o errexit -o nounset
 rm -rf doc/html
 ${SPHINX} ${@} -b html -d doc/.doctrees doc doc/html
+
+if command -v makeinfo &>/dev/null; then
+    rm -rf doc/texinfo
+    ${SPHINX} ${@} -b texinfo -d doc/.doctrees doc doc/texinfo && \
+        make -C doc/texinfo info
+fi
--
2.25.2