meson: Move the detection logic for sphinx to meson

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Message-Id: <20201015220626.418-4-luoyonggang@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
Yonggang Luo 2020-10-16 06:06:25 +08:00 committed by Paolo Bonzini
parent 9dc6ee3fd7
commit e366766046
4 changed files with 64 additions and 75 deletions

59
configure vendored
View file

@ -297,7 +297,7 @@ brlapi=""
curl=""
iconv="auto"
curses="auto"
docs=""
docs="auto"
fdt="auto"
netmap="no"
sdl="auto"
@ -820,15 +820,6 @@ do
fi
done
sphinx_build=
for binary in sphinx-build-3 sphinx-build
do
if has "$binary"
then
sphinx_build=$(command -v "$binary")
break
fi
done
# Check for ancillary tools used in testing
genisoimage=
@ -1228,9 +1219,9 @@ for opt do
;;
--disable-crypto-afalg) crypto_afalg="no"
;;
--disable-docs) docs="no"
--disable-docs) docs="disabled"
;;
--enable-docs) docs="yes"
--enable-docs) docs="enabled"
;;
--disable-vhost-net) vhost_net="no"
;;
@ -4419,45 +4410,6 @@ if check_include linux/btrfs.h ; then
btrfs=yes
fi
# If we're making warnings fatal, apply this to Sphinx runs as well
sphinx_werror=""
if test "$werror" = "yes"; then
sphinx_werror="-W"
fi
# Check we have a new enough version of sphinx-build
has_sphinx_build() {
# 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 either
# sphinx-build doesn't exist at all or if it is too old.
mkdir -p "$TMPDIR1/sphinx"
touch "$TMPDIR1/sphinx/index.rst"
"$sphinx_build" $sphinx_werror -c "$source_path/docs" \
-b html "$TMPDIR1/sphinx" \
"$TMPDIR1/sphinx/out" >> config.log 2>&1
}
# Check if tools are available to build documentation.
if test "$docs" != "no" ; then
if has_sphinx_build; then
sphinx_ok=yes
else
sphinx_ok=no
fi
if test "$sphinx_ok" = "yes"; then
docs=yes
else
if test "$docs" = "yes" ; then
if has $sphinx_build && test "$sphinx_ok" != "yes"; then
echo "Warning: $sphinx_build exists but it is either too old or uses too old a Python version" >&2
fi
feature_not_found "docs" "Install a Python 3 version of python-sphinx"
fi
docs=no
fi
fi
# Search for bswap_32 function
byteswap_h=no
cat > $TMPC << EOF
@ -6093,9 +6045,6 @@ qemu_version=$(head $source_path/VERSION)
echo "PKGVERSION=$pkgversion" >>$config_host_mak
echo "SRC_PATH=$source_path" >> $config_host_mak
echo "TARGET_DIRS=$target_list" >> $config_host_mak
if [ "$docs" = "yes" ] ; then
echo "BUILD_DOCS=yes" >> $config_host_mak
fi
if test "$modules" = "yes"; then
# $shacmd can generate a hash started with digit, which the compiler doesn't
# like as an symbol. So prefix it with an underscore
@ -6784,7 +6733,6 @@ fi
echo "ROMS=$roms" >> $config_host_mak
echo "MAKE=$make" >> $config_host_mak
echo "PYTHON=$python" >> $config_host_mak
echo "SPHINX_BUILD=$sphinx_build" >> $config_host_mak
echo "GENISOIMAGE=$genisoimage" >> $config_host_mak
echo "MESON=$meson" >> $config_host_mak
echo "NINJA=$ninja" >> $config_host_mak
@ -7066,6 +7014,7 @@ NINJA=$ninja $meson setup \
-Dgettext=$gettext -Dxkbcommon=$xkbcommon -Du2f=$u2f \
-Dcapstone=$capstone -Dslirp=$slirp -Dfdt=$fdt \
-Diconv=$iconv -Dcurses=$curses -Dlibudev=$libudev\
-Ddocs=$docs -Dsphinx_build=$sphinx_build \
$cross_arg \
"$PWD" "$source_path"