qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Subject: [PATCH 09/24] configure, meson: move --enable-modules to Meson
Date: Thu, 11 May 2023 11:50:06 +0200	[thread overview]
Message-ID: <20230511095021.1397802-10-pbonzini@redhat.com> (raw)
In-Reply-To: <20230511095021.1397802-1-pbonzini@redhat.com>

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 configure                     | 20 --------------------
 meson.build                   | 22 ++++++++++++++--------
 meson_options.txt             |  2 ++
 scripts/meson-buildoptions.sh |  3 +++
 tests/qtest/meson.build       |  2 +-
 5 files changed, 20 insertions(+), 29 deletions(-)

diff --git a/configure b/configure
index 838d35bfa2f3..1edc6987dee5 100755
--- a/configure
+++ b/configure
@@ -280,7 +280,6 @@ tsan="no"
 fortify_source="yes"
 docs="auto"
 EXESUF=""
-modules="no"
 prefix="/usr/local"
 qemu_suffix="qemu"
 softmmu="yes"
@@ -752,12 +751,6 @@ for opt do
   ;;
   --disable-docs) docs=disabled
   ;;
-  --enable-modules)
-      modules="yes"
-  ;;
-  --disable-modules)
-      modules="no"
-  ;;
   --cpu=*)
   ;;
   --target-list=*) target_list="$optarg"
@@ -1051,7 +1044,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
@@ -1342,16 +1334,7 @@ EOF
   fi
 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
 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
@@ -2308,9 +2291,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 f1a74126f506..7e8b29a8fc0b 100644
--- a/meson.build
+++ b/meson.build
@@ -17,7 +17,6 @@ fs = import('fs')
 targetos = host_machine.system()
 sh = find_program('sh')
 config_host = keyval.load(meson.current_build_dir() / 'config-host.mak')
-enable_modules = 'CONFIG_MODULES' in config_host
 
 cc = meson.get_compiler('c')
 all_languages = ['c']
@@ -84,6 +83,12 @@ have_ga = get_option('guest_agent') \
   .require(targetos in ['sunos', 'linux', 'windows', 'freebsd', 'netbsd', 'openbsd'],
            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()
@@ -498,7 +503,7 @@ glib_req_ver = '>=2.56.0'
 glib_pc = dependency('glib-2.0', version: glib_req_ver, required: true,
                     method: 'pkg-config')
 glib_cflags = []
-if config_host.has_key('CONFIG_MODULES')
+if enable_modules
   gmodule = dependency('gmodule-export-2.0', version: glib_req_ver, required: true,
                        method: 'pkg-config')
 elif config_host.has_key('CONFIG_PLUGIN')
@@ -1725,7 +1730,7 @@ if get_option('cfi')
   if not get_option('b_lto')
     error('Selected Control-Flow Integrity but LTO is disabled')
   endif
-  if config_host.has_key('CONFIG_MODULES')
+  if enable_modules
     error('Selected Control-Flow Integrity is not compatible with modules')
   endif
   # Check for cfi flags. CFI requires LTO so we can't use
@@ -1823,7 +1828,7 @@ config_host_data.set_quoted('CONFIG_QEMU_LOCALSTATEDIR', get_option('prefix') /
 config_host_data.set_quoted('CONFIG_QEMU_MODDIR', get_option('prefix') / qemu_moddir)
 config_host_data.set_quoted('CONFIG_SYSCONFDIR', get_option('prefix') / get_option('sysconfdir'))
 
-if config_host.has_key('CONFIG_MODULES')
+if enable_modules
   config_host_data.set('CONFIG_STAMP', run_command(
       meson.current_source_dir() / 'scripts/qemu-stamp.py',
       meson.project_version(), get_option('pkgversion'), '--',
@@ -1886,6 +1891,7 @@ config_host_data.set('CONFIG_LIBSSH', libssh.found())
 config_host_data.set('CONFIG_LINUX_AIO', libaio.found())
 config_host_data.set('CONFIG_LINUX_IO_URING', linux_io_uring.found())
 config_host_data.set('CONFIG_LIBPMEM', libpmem.found())
+config_host_data.set('CONFIG_MODULES', enable_modules)
 config_host_data.set('CONFIG_NUMA', numa.found())
 if numa.found()
   config_host_data.set('HAVE_NUMA_HAS_PREFERRED_MANY',
@@ -3230,7 +3236,7 @@ foreach d, list : modules
   endif
 
   foreach m, module_ss : list
-    if enable_modules and targetos != 'windows'
+    if enable_modules
       module_ss = module_ss.apply(config_all, strict: false)
       sl = static_library(d + '-' + m, [genh, module_ss.sources()],
                           dependencies: [modulecommon, module_ss.dependencies()], pic: true)
@@ -3263,7 +3269,7 @@ endforeach
 
 foreach d, list : target_modules
   foreach m, module_ss : list
-    if enable_modules and targetos != 'windows'
+    if enable_modules
       foreach target : target_dirs
         if target.endswith('-softmmu')
           config_target = config_target_mak[target]
@@ -3783,8 +3789,8 @@ summary_info += {'system-mode emulation': have_system}
 summary_info += {'user-mode emulation': have_user}
 summary_info += {'block layer':       have_block}
 summary_info += {'Install blobs':     get_option('install_blobs')}
-summary_info += {'module support':    config_host.has_key('CONFIG_MODULES')}
-if config_host.has_key('CONFIG_MODULES')
+summary_info += {'module support':    enable_modules}
+if enable_modules
   summary_info += {'alternative module path': get_option('module_upgrades')}
 endif
 summary_info += {'fuzzing support':   get_option('fuzzing')}
diff --git a/meson_options.txt b/meson_options.txt
index b2ee1e7f2d72..b118258eb9a3 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -42,6 +42,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 52e59d25b8fa..7bc40c4d893a 100644
--- a/scripts/meson-buildoptions.sh
+++ b/scripts/meson-buildoptions.sh
@@ -125,6 +125,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'
@@ -350,6 +351,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 ;;
diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build
index 48cd35b5b203..ab422772d310 100644
--- a/tests/qtest/meson.build
+++ b/tests/qtest/meson.build
@@ -23,7 +23,7 @@ qtests_generic = [
   'readconfig-test',
   'netdev-socket',
 ]
-if config_host.has_key('CONFIG_MODULES')
+if enable_modules
   qtests_generic += [ 'modules-test' ]
 endif
 
-- 
2.40.1



  parent reply	other threads:[~2023-05-11  9:54 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-11  9:49 [PATCH 00/24] Meson changes for QEMU 8.1 Paolo Bonzini
2023-05-11  9:49 ` [PATCH 01/24] meson: regenerate meson-buildoptions.sh Paolo Bonzini
2023-05-11  9:49 ` [PATCH 02/24] meson: require 0.63.0 Paolo Bonzini
2023-05-11  9:50 ` [PATCH 03/24] meson: use prefer_static option Paolo Bonzini
2023-05-11  9:50 ` [PATCH 04/24] meson: remove static_kwargs Paolo Bonzini
2023-05-11  9:50 ` [PATCH 05/24] meson: add more version numbers to the summary Paolo Bonzini
2023-05-11  9:50 ` [PATCH 06/24] meson: drop unnecessary declare_dependency() Paolo Bonzini
2023-05-11  9:50 ` [PATCH 07/24] build: move glib detection and workarounds to meson Paolo Bonzini
2023-05-11  9:50 ` [PATCH 08/24] configure: remove pkg-config functions Paolo Bonzini
2023-05-11  9:50 ` Paolo Bonzini [this message]
2023-05-11  9:50 ` [PATCH 10/24] meson: prepare move of QEMU_CFLAGS to meson Paolo Bonzini
2023-05-11  9:50 ` [PATCH 11/24] build: move sanitizer tests " Paolo Bonzini
2023-05-11  9:50 ` [PATCH 12/24] build: move SafeStack " Paolo Bonzini
2023-05-11  9:50 ` [PATCH 13/24] build: move coroutine backend selection " Paolo Bonzini
2023-05-11  9:50 ` [PATCH 14/24] build: move stack protector flag " Paolo Bonzini
2023-05-11  9:50 ` [PATCH 15/24] build: move warning " Paolo Bonzini
2023-05-11  9:50 ` [PATCH 16/24] build: move remaining compiler flag tests " Paolo Bonzini
2023-05-11  9:50 ` [PATCH 17/24] build: move compiler version check " Paolo Bonzini
2023-05-11  9:50 ` [PATCH 18/24] build: move --disable-debug-info " Paolo Bonzini
2023-07-26  6:45   ` Michael Tokarev
2023-05-11  9:50 ` [PATCH 19/24] configure: remove compiler sanity check Paolo Bonzini
2024-01-18 19:23   ` Thomas Huth
2023-05-11  9:50 ` [PATCH 20/24] configure: do not rerun the tests with -Werror Paolo Bonzini
2023-05-11  9:50 ` [PATCH 21/24] configure: remove unnecessary mkdir Paolo Bonzini
2023-05-11  9:50 ` [PATCH 22/24] configure: reorder option parsing code Paolo Bonzini
2023-05-11  9:50 ` [PATCH 23/24] configure: remove unnecessary check Paolo Bonzini
2023-05-11  9:50 ` [PATCH 24/24] docs/devel: update build system docs Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230511095021.1397802-10-pbonzini@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).