aboutsummaryrefslogtreecommitdiff
path: root/configure
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2019-06-10 12:05:14 +0200
committerPaolo Bonzini <pbonzini@redhat.com>2020-08-21 06:30:05 -0400
commita56650518f5ba84ed15b9415fa1041311eeeece0 (patch)
treee0bb21d39cfeee9e6f4e03a48ef784a5fc27e400 /configure
parentdedad0272052f3d848d6d178b681526b2f313029 (diff)
configure: integrate Meson in the build system
The Meson build system is integrated in the existing configure/make steps by invoking Meson from the configure script and converting Meson's build.ninja rules to an included Makefile. build.ninja already provides tags/ctags/cscope rules, so they are removed. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'configure')
-rwxr-xr-xconfigure52
1 files changed, 48 insertions, 4 deletions
diff --git a/configure b/configure
index f86e03981e..26d571afca 100755
--- a/configure
+++ b/configure
@@ -552,6 +552,8 @@ fuzzing="no"
rng_none="no"
secret_keyring=""
libdaxctl=""
+meson=""
+skip_meson=no
supported_cpu="no"
supported_os="no"
@@ -1048,6 +1050,10 @@ for opt do
;;
--sphinx-build=*) sphinx_build="$optarg"
;;
+ --skip-meson) skip_meson=yes
+ ;;
+ --meson=*) meson="$optarg"
+ ;;
--gcov=*) gcov_tool="$optarg"
;;
--smbd=*) smbd="$optarg"
@@ -1813,6 +1819,7 @@ Advanced options (experts only):
--install=INSTALL use specified install [$install]
--python=PYTHON use specified python [$python]
--sphinx-build=SPHINX use specified sphinx-build [$sphinx_build]
+ --meson=MESON use specified meson [$meson]
--smbd=SMBD use specified smbd [$smbd]
--with-git=GIT use specified git [$git]
--static enable static build [$static]
@@ -2020,6 +2027,16 @@ python_version=$($python -c 'import sys; print("%d.%d.%d" % (sys.version_info[0]
# Suppress writing compiled files
python="$python -B"
+if ! has "$meson"
+then
+ error_exit "Meson not found. Use --meson=/path/to/meson"
+fi
+meson=$(command -v $meson)
+
+if ! $python -c 'import pkg_resources' > /dev/null 2>&1; then
+ error_exit "Python setuptools not found"
+fi
+
# Check that the C compiler works. Doing this here before testing
# the host CPU ensures that we had a valid CC to autodetect the
# $cpu var (and we should bail right here if that's not the case).
@@ -6550,13 +6567,13 @@ elif test "$fortify_source" = "yes" ; then
QEMU_CFLAGS="-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $QEMU_CFLAGS"
debug=no
fi
-if test "$debug" = "no"; then
- CFLAGS="-O2 $CFLAGS"
-fi
if test "$debug_info" = "yes"; then
CFLAGS="-g $CFLAGS"
LDFLAGS="-g $LDFLAGS"
fi
+if test "$debug" = "no"; then
+ CFLAGS="-O2 $CFLAGS"
+fi
case "$ARCH" in
alpha)
@@ -8001,6 +8018,7 @@ echo "PYTHON=$python" >> $config_host_mak
echo "SPHINX_BUILD=$sphinx_build" >> $config_host_mak
echo "SPHINX_WERROR=$sphinx_werror" >> $config_host_mak
echo "GENISOIMAGE=$genisoimage" >> $config_host_mak
+echo "MESON=$meson" >> $config_host_mak
echo "CC=$cc" >> $config_host_mak
if $iasl -h > /dev/null 2>&1; then
echo "IASL=$iasl" >> $config_host_mak
@@ -8611,6 +8629,30 @@ echo "# Automatically generated by configure - do not modify" > "$iotests_common
echo >> "$iotests_common_env"
echo "export PYTHON='$python'" >> "$iotests_common_env"
+if test "$skip_meson" = no; then
+rm -rf meson-private meson-info meson-logs
+NINJA=$PWD/ninjatool $meson setup \
+ --prefix "$prefix" \
+ --libdir "$libdir" \
+ --libexecdir "$libexecdir" \
+ --bindir "$bindir" \
+ --includedir "$includedir" \
+ --datadir "$datadir" \
+ --mandir "$mandir" \
+ --sysconfdir "$sysconfdir" \
+ --localstatedir "$local_statedir" \
+ -Doptimization=$(if test "$debug" = yes; then echo 0; else echo 2; fi) \
+ -Ddebug=$(if test "$debug_info" = yes; then echo true; else echo false; fi) \
+ -Dwerror=$(if test "$werror" = yes; then echo true; else echo false; fi) \
+ -Dstrip=$(if test "$strip_opt" = yes; then echo true; else echo false; fi) \
+ "$PWD" "$source_path"
+
+if test "$?" -ne 0 ; then
+ error_exit "meson setup failed"
+fi
+touch ninjatool.stamp
+fi
+
# Save the configure command line for later reuse.
cat <<EOD >config.status
#!/bin/sh
@@ -8659,7 +8701,9 @@ preserve_env STRIP
preserve_env WINDRES
printf "exec" >>config.status
-printf " '%s'" "$0" "$@" >>config.status
+for i in "$0" "$@"; do
+ test "$i" = --skip-meson || printf " '%s'" "$i" >>config.status
+done
echo ' "$@"' >>config.status
chmod +x config.status