diff mbox series

[18/30] configure, meson: move --enable-modules to Meson

Message ID 20221209112409.184703-19-pbonzini@redhat.com
State New
Headers show
Series Meson changes for QEMU 8.0 | expand

Commit Message

Paolo Bonzini Dec. 9, 2022, 11:23 a.m. UTC
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 configure                     | 21 +--------------------
 meson.build                   |  7 ++++++-
 meson_options.txt             |  2 ++
 scripts/meson-buildoptions.sh |  3 +++
 4 files changed, 12 insertions(+), 21 deletions(-)

Comments

Marc-André Lureau Dec. 12, 2022, 9:07 a.m. UTC | #1
On Fri, Dec 9, 2022 at 3:44 PM Paolo Bonzini <pbonzini@redhat.com> wrote:
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

On Fri, Dec 9, 2022 at 3:39 PM Paolo Bonzini <pbonzini@redhat.com> wrote:
>
> All uses of pkg-config have been moved to Meson.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>

> ---
>  configure                     | 21 +--------------------
>  meson.build                   |  7 ++++++-
>  meson_options.txt             |  2 ++
>  scripts/meson-buildoptions.sh |  3 +++
>  4 files changed, 12 insertions(+), 21 deletions(-)
>
> diff --git a/configure b/configure
> index 9c336203d8d9..26d10aeffd82 100755
> --- a/configure
> +++ b/configure
> @@ -273,7 +273,6 @@ sanitizers="no"
>  tsan="no"
>  fortify_source="yes"
>  EXESUF=""
> -modules="no"
>  prefix="/usr/local"
>  qemu_suffix="qemu"
>  softmmu="yes"
> @@ -705,12 +704,6 @@ for opt do
>    ;;
>    --disable-debug-info) meson_option_add -Ddebug=false
>    ;;
> -  --enable-modules)
> -      modules="yes"
> -  ;;
> -  --disable-modules)
> -      modules="no"
> -  ;;
>    --cpu=*)
>    ;;
>    --target-list=*) target_list="$optarg"
> @@ -1001,7 +994,6 @@ cat << EOF
>    linux-user      all linux usermode emulation targets
>    bsd-user        all BSD usermode emulation targets
>    pie             Position Independent Executables
> -  modules         modules support (non-Windows)
>    debug-tcg       TCG debugging (default is disabled)
>    debug-info      debugging information
>    safe-stack      SafeStack Stack Smash Protection. Depends on
> @@ -1260,16 +1252,8 @@ else
>    QEMU_CFLAGS="$QEMU_CFLAGS -Wno-missing-braces"
>  fi
>
> -# Our module code doesn't support Windows
> -if test "$modules" = "yes" && test "$mingw32" = "yes" ; then
> -  error_exit "Modules are not available for Windows"
> -fi
> -
> -# Static linking is not possible with plugins, modules or PIE
> +# Resolve default for --enable-plugins
>  if test "$static" = "yes" ; then
> -  if test "$modules" = "yes" ; then
> -    error_exit "static and modules are mutually incompatible"
> -  fi
>    if test "$plugins" = "yes"; then
>      error_exit "static and plugins are mutually incompatible"
>    else
> @@ -2229,9 +2213,6 @@ if test "$solaris" = "yes" ; then
>  fi
>  echo "SRC_PATH=$source_path" >> $config_host_mak
>  echo "TARGET_DIRS=$target_list" >> $config_host_mak
> -if test "$modules" = "yes"; then
> -  echo "CONFIG_MODULES=y" >> $config_host_mak
> -fi
>
>  # XXX: suppress that
>  if [ "$bsd" = "yes" ] ; then
> diff --git a/meson.build b/meson.build
> index f63ab7f83bed..99c1bde4d154 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -16,7 +16,6 @@ fs = import('fs')
>
>  sh = find_program('sh')
>  config_host = keyval.load(meson.current_build_dir() / 'config-host.mak')
> -enable_modules = 'CONFIG_MODULES' in config_host
>  targetos = host_machine.system()
>
>  cc = meson.get_compiler('c')
> @@ -84,6 +83,12 @@ have_ga = get_option('guest_agent') \
>    .require(targetos in ['sunos', 'linux', 'windows', 'freebsd'],
>             error_message: 'unsupported OS for QEMU guest agent') \
>    .allowed()
> +enable_modules = get_option('modules') \
> +  .require(targetos != 'windows',
> +           error_message: 'Modules are not available for Windows') \
> +  .require(not get_option('prefer_static'),
> +           error_message: 'Modules are incompatible with static linking') \
> +  .allowed()
>  have_block = have_system or have_tools
>
>  python = import('python').find_installation()
> diff --git a/meson_options.txt b/meson_options.txt
> index 4b749ca54900..e492aaa73fbc 100644
> --- a/meson_options.txt
> +++ b/meson_options.txt
> @@ -44,6 +44,8 @@ option('fuzzing', type : 'boolean', value: false,
>         description: 'build fuzzing targets')
>  option('gettext', type : 'feature', value : 'auto',
>         description: 'Localization of the GTK+ user interface')
> +option('modules', type : 'feature', value : 'disabled',
> +       description: 'modules support (non Windows)')
>  option('module_upgrades', type : 'boolean', value : false,
>         description: 'try to load modules from alternate paths for upgrades')
>  option('install_blobs', type : 'boolean', value : true,
> diff --git a/scripts/meson-buildoptions.sh b/scripts/meson-buildoptions.sh
> index aa6e30ea911e..f91797741eef 100644
> --- a/scripts/meson-buildoptions.sh
> +++ b/scripts/meson-buildoptions.sh
> @@ -119,6 +119,7 @@ meson_options_help() {
>    printf "%s\n" '  lzo             lzo compression support'
>    printf "%s\n" '  malloc-trim     enable libc malloc_trim() for memory optimization'
>    printf "%s\n" '  membarrier      membarrier system call (for Linux 4.14+ or Windows'
> +  printf "%s\n" '  modules         modules support (non Windows)'
>    printf "%s\n" '  mpath           Multipath persistent reservation passthrough'
>    printf "%s\n" '  multiprocess    Out of process device emulation support'
>    printf "%s\n" '  netmap          netmap network backend support'
> @@ -338,6 +339,8 @@ _meson_option_parse() {
>      --disable-membarrier) printf "%s" -Dmembarrier=disabled ;;
>      --enable-module-upgrades) printf "%s" -Dmodule_upgrades=true ;;
>      --disable-module-upgrades) printf "%s" -Dmodule_upgrades=false ;;
> +    --enable-modules) printf "%s" -Dmodules=enabled ;;
> +    --disable-modules) printf "%s" -Dmodules=disabled ;;
>      --enable-mpath) printf "%s" -Dmpath=enabled ;;
>      --disable-mpath) printf "%s" -Dmpath=disabled ;;
>      --enable-multiprocess) printf "%s" -Dmultiprocess=enabled ;;
> --
> 2.38.1
>
>
Daniel P. Berrangé Dec. 16, 2022, 3:09 p.m. UTC | #2
On Fri, Dec 09, 2022 at 12:23:57PM +0100, Paolo Bonzini wrote:
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  configure                     | 21 +--------------------
>  meson.build                   |  7 ++++++-
>  meson_options.txt             |  2 ++
>  scripts/meson-buildoptions.sh |  3 +++
>  4 files changed, 12 insertions(+), 21 deletions(-)

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>


With regards,
Daniel
diff mbox series

Patch

diff --git a/configure b/configure
index 9c336203d8d9..26d10aeffd82 100755
--- a/configure
+++ b/configure
@@ -273,7 +273,6 @@  sanitizers="no"
 tsan="no"
 fortify_source="yes"
 EXESUF=""
-modules="no"
 prefix="/usr/local"
 qemu_suffix="qemu"
 softmmu="yes"
@@ -705,12 +704,6 @@  for opt do
   ;;
   --disable-debug-info) meson_option_add -Ddebug=false
   ;;
-  --enable-modules)
-      modules="yes"
-  ;;
-  --disable-modules)
-      modules="no"
-  ;;
   --cpu=*)
   ;;
   --target-list=*) target_list="$optarg"
@@ -1001,7 +994,6 @@  cat << EOF
   linux-user      all linux usermode emulation targets
   bsd-user        all BSD usermode emulation targets
   pie             Position Independent Executables
-  modules         modules support (non-Windows)
   debug-tcg       TCG debugging (default is disabled)
   debug-info      debugging information
   safe-stack      SafeStack Stack Smash Protection. Depends on
@@ -1260,16 +1252,8 @@  else
   QEMU_CFLAGS="$QEMU_CFLAGS -Wno-missing-braces"
 fi
 
-# Our module code doesn't support Windows
-if test "$modules" = "yes" && test "$mingw32" = "yes" ; then
-  error_exit "Modules are not available for Windows"
-fi
-
-# Static linking is not possible with plugins, modules or PIE
+# Resolve default for --enable-plugins
 if test "$static" = "yes" ; then
-  if test "$modules" = "yes" ; then
-    error_exit "static and modules are mutually incompatible"
-  fi
   if test "$plugins" = "yes"; then
     error_exit "static and plugins are mutually incompatible"
   else
@@ -2229,9 +2213,6 @@  if test "$solaris" = "yes" ; then
 fi
 echo "SRC_PATH=$source_path" >> $config_host_mak
 echo "TARGET_DIRS=$target_list" >> $config_host_mak
-if test "$modules" = "yes"; then
-  echo "CONFIG_MODULES=y" >> $config_host_mak
-fi
 
 # XXX: suppress that
 if [ "$bsd" = "yes" ] ; then
diff --git a/meson.build b/meson.build
index f63ab7f83bed..99c1bde4d154 100644
--- a/meson.build
+++ b/meson.build
@@ -16,7 +16,6 @@  fs = import('fs')
 
 sh = find_program('sh')
 config_host = keyval.load(meson.current_build_dir() / 'config-host.mak')
-enable_modules = 'CONFIG_MODULES' in config_host
 targetos = host_machine.system()
 
 cc = meson.get_compiler('c')
@@ -84,6 +83,12 @@  have_ga = get_option('guest_agent') \
   .require(targetos in ['sunos', 'linux', 'windows', 'freebsd'],
            error_message: 'unsupported OS for QEMU guest agent') \
   .allowed()
+enable_modules = get_option('modules') \
+  .require(targetos != 'windows',
+           error_message: 'Modules are not available for Windows') \
+  .require(not get_option('prefer_static'),
+           error_message: 'Modules are incompatible with static linking') \
+  .allowed()
 have_block = have_system or have_tools
 
 python = import('python').find_installation()
diff --git a/meson_options.txt b/meson_options.txt
index 4b749ca54900..e492aaa73fbc 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -44,6 +44,8 @@  option('fuzzing', type : 'boolean', value: false,
        description: 'build fuzzing targets')
 option('gettext', type : 'feature', value : 'auto',
        description: 'Localization of the GTK+ user interface')
+option('modules', type : 'feature', value : 'disabled',
+       description: 'modules support (non Windows)')
 option('module_upgrades', type : 'boolean', value : false,
        description: 'try to load modules from alternate paths for upgrades')
 option('install_blobs', type : 'boolean', value : true,
diff --git a/scripts/meson-buildoptions.sh b/scripts/meson-buildoptions.sh
index aa6e30ea911e..f91797741eef 100644
--- a/scripts/meson-buildoptions.sh
+++ b/scripts/meson-buildoptions.sh
@@ -119,6 +119,7 @@  meson_options_help() {
   printf "%s\n" '  lzo             lzo compression support'
   printf "%s\n" '  malloc-trim     enable libc malloc_trim() for memory optimization'
   printf "%s\n" '  membarrier      membarrier system call (for Linux 4.14+ or Windows'
+  printf "%s\n" '  modules         modules support (non Windows)'
   printf "%s\n" '  mpath           Multipath persistent reservation passthrough'
   printf "%s\n" '  multiprocess    Out of process device emulation support'
   printf "%s\n" '  netmap          netmap network backend support'
@@ -338,6 +339,8 @@  _meson_option_parse() {
     --disable-membarrier) printf "%s" -Dmembarrier=disabled ;;
     --enable-module-upgrades) printf "%s" -Dmodule_upgrades=true ;;
     --disable-module-upgrades) printf "%s" -Dmodule_upgrades=false ;;
+    --enable-modules) printf "%s" -Dmodules=enabled ;;
+    --disable-modules) printf "%s" -Dmodules=disabled ;;
     --enable-mpath) printf "%s" -Dmpath=enabled ;;
     --disable-mpath) printf "%s" -Dmpath=disabled ;;
     --enable-multiprocess) printf "%s" -Dmultiprocess=enabled ;;