if get_option('sphinx_build') == ''
  sphinx_build = find_program(['sphinx-build-3', 'sphinx-build'],
                              required: get_option('docs'))
else
  sphinx_build = find_program(get_option('sphinx_build'),
                              required: get_option('docs'))
endif

# Check if tools are available to build documentation.
build_docs = false
if sphinx_build.found()
  SPHINX_ARGS = [sphinx_build]
  # If we're making warnings fatal, apply this to Sphinx runs as well
  if get_option('werror')
    SPHINX_ARGS += [ '-W' ]
  endif

  # This is a bit awkward but works: create a trivial document and
  # try to run it with our configuration file (which enforces a
  # version requirement). This will fail if sphinx-build is too old.
  run_command('mkdir', ['-p', tmpdir / 'sphinx'])
  run_command('touch', [tmpdir / 'sphinx/index.rst'])
  sphinx_build_test_out = run_command(SPHINX_ARGS + [
    '-c', meson.current_source_dir(),
    '-b', 'html', tmpdir / 'sphinx',
    tmpdir / 'sphinx/out'])
  build_docs = (sphinx_build_test_out.returncode() == 0)

  if not build_docs
    warning('@0@ exists but it is either too old or uses too old a Python version'.format(get_option('sphinx_build')))
    if get_option('docs').enabled()
      error('Install a Python 3 version of python-sphinx')
    endif
  endif
endif

if build_docs
  SPHINX_ARGS += ['-Dversion=' + meson.project_version(), '-Drelease=' + config_host['PKGVERSION']]

  sphinx_extn_depends = [ meson.source_root() / 'docs/sphinx/depfile.py',
                          meson.source_root() / 'docs/sphinx/hxtool.py',
                          meson.source_root() / 'docs/sphinx/kerneldoc.py',
                          meson.source_root() / 'docs/sphinx/kernellog.py',
                          meson.source_root() / 'docs/sphinx/qapidoc.py',
                          meson.source_root() / 'docs/sphinx/qmp_lexer.py',
                          qapi_gen_depends ]

  configure_file(output: 'index.html',
                 input: files('index.html.in'),
                 configuration: {'VERSION': meson.project_version()},
                 install_dir: qemu_docdir)
  manuals = [ 'devel', 'interop', 'tools', 'specs', 'system', 'user' ]
  man_pages = {
    'interop' : {
        'qemu-ga.8': (have_tools ? 'man8' : ''),
        'qemu-ga-ref.7': 'man7',
        'qemu-qmp-ref.7': 'man7',
    },
    'tools': {
        'qemu-img.1': (have_tools ? 'man1' : ''),
        'qemu-nbd.8': (have_tools ? 'man8' : ''),
        'qemu-trace-stap.1': (config_host.has_key('CONFIG_TRACE_SYSTEMTAP') ? 'man1' : ''),
        'virtfs-proxy-helper.1': (have_virtfs_proxy_helper ? 'man1' : ''),
        'virtiofsd.1': (have_virtiofsd ? 'man1' : ''),
    },
    'system': {
        'qemu.1': 'man1',
        'qemu-block-drivers.7': 'man7',
        'qemu-cpu-models.7': 'man7'
    },
  }

  sphinxdocs = []
  sphinxmans = []
  foreach manual : manuals
    private_dir = meson.current_build_dir() / (manual + '.p')
    output_dir = meson.current_build_dir() / manual
    input_dir = meson.current_source_dir() / manual

    this_manual = custom_target(manual + ' manual',
                build_by_default: build_docs,
                output: [manual + '.stamp'],
                input: [files('conf.py'), files(manual / 'conf.py')],
                depfile: manual + '.d',
                depend_files: sphinx_extn_depends,
                command: [SPHINX_ARGS, '-Ddepfile=@DEPFILE@',
                          '-Ddepfile_stamp=@OUTPUT0@',
                          '-b', 'html', '-d', private_dir,
                          input_dir, output_dir])
    sphinxdocs += this_manual
    if build_docs and manual != 'devel'
      install_subdir(output_dir, install_dir: qemu_docdir)
    endif

    these_man_pages = []
    install_dirs = []
    foreach page, section : man_pages.get(manual, {})
      these_man_pages += page
      install_dirs += section == '' ? false : get_option('mandir') / section
    endforeach
    if these_man_pages.length() > 0
      sphinxmans += custom_target(manual + ' man pages',
                         build_by_default: build_docs,
                         output: these_man_pages,
                         input: this_manual,
                         install: build_docs,
                         install_dir: install_dirs,
                         command: [SPHINX_ARGS, '-b', 'man', '-d', private_dir,
                                   input_dir, meson.current_build_dir()])
    endif
  endforeach
  alias_target('sphinxdocs', sphinxdocs)
  alias_target('html', sphinxdocs)
  alias_target('man', sphinxmans)
endif
