aboutsummaryrefslogtreecommitdiff
path: root/meson.build
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2022-07-14 14:33:49 +0200
committerPaolo Bonzini <pbonzini@redhat.com>2023-05-18 08:53:51 +0200
commita0cbd2e8496aa8a80241fca3b247a54709c5ed26 (patch)
tree397e6269d0beb8efd9308e57fcf29e050d76cc36 /meson.build
parent3b087f79a48807f348ea61469175e66b28ba44de (diff)
downloadqemu-a0cbd2e8496aa8a80241fca3b247a54709c5ed26.zip
qemu-a0cbd2e8496aa8a80241fca3b247a54709c5ed26.tar.gz
qemu-a0cbd2e8496aa8a80241fca3b247a54709c5ed26.tar.bz2
meson: use prefer_static option
The option is new in Meson 0.63 and removes the need to pass "static: true" to all dependency and find_library invocation. Actually cleaning up the invocations is left for a separate patch. Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'meson.build')
-rw-r--r--meson.build13
1 files changed, 5 insertions, 8 deletions
diff --git a/meson.build b/meson.build
index d85637e..7634f8b 100644
--- a/meson.build
+++ b/meson.build
@@ -18,10 +18,7 @@ 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
-enable_static = 'CONFIG_STATIC' in config_host
-
-# Allow both shared and static libraries unless --enable-static
-static_kwargs = enable_static ? {'static': true} : {}
+static_kwargs = {}
cc = meson.get_compiler('c')
all_languages = ['c']
@@ -193,7 +190,7 @@ qemu_cflags = config_host['QEMU_CFLAGS'].split()
qemu_objcflags = config_host['QEMU_OBJCFLAGS'].split()
qemu_ldflags = config_host['QEMU_LDFLAGS'].split()
-if enable_static
+if get_option('prefer_static')
qemu_ldflags += get_option('b_pie') ? '-static-pie' : '-static'
endif
@@ -841,7 +838,7 @@ if targetos == 'linux' and have_tools and get_option('mpath').allowed()
kwargs: static_kwargs)
if libmpathpersist.found()
mpathlibs += libmpathpersist
- if enable_static
+ if get_option('prefer_static')
mpathlibs += cc.find_library('devmapper',
required: get_option('mpath'),
kwargs: static_kwargs)
@@ -1225,7 +1222,7 @@ if not gnutls_crypto.found()
# Debian has removed -lgpg-error from libgcrypt-config
# as it "spreads unnecessary dependencies" which in
# turn breaks static builds...
- if gcrypt.found() and enable_static
+ if gcrypt.found() and get_option('prefer_static')
gcrypt = declare_dependency(dependencies: [
gcrypt,
cc.find_library('gpg-error', required: true, kwargs: static_kwargs)])
@@ -1657,7 +1654,7 @@ endif
# libdw
libdw = not_found
if not get_option('libdw').auto() or \
- (not enable_static and (have_system or have_user))
+ (not get_option('prefer_static') and (have_system or have_user))
libdw = dependency('libdw',
method: 'pkg-config',
kwargs: static_kwargs,