]> git.proxmox.com Git - mirror_qemu.git/blobdiff - configure
configure: integrate Meson in the build system
[mirror_qemu.git] / configure
index f86e03981e896296434eaed96e756cc23fe9e40d..26d571afcaa6a92984a2b9430ce2360fba13cead 100755 (executable)
--- 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