meson: remove static_kwargs

After static_kwargs has been changed to an empty dictionary, it has
no functional effect and can be removed.

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
Paolo Bonzini 2022-07-14 14:56:58 +02:00
parent a0cbd2e849
commit 063d5119c1
2 changed files with 85 additions and 132 deletions

View file

@ -18,7 +18,6 @@ targetos = host_machine.system()
sh = find_program('sh') sh = find_program('sh')
config_host = keyval.load(meson.current_build_dir() / 'config-host.mak') config_host = keyval.load(meson.current_build_dir() / 'config-host.mak')
enable_modules = 'CONFIG_MODULES' in config_host enable_modules = 'CONFIG_MODULES' in config_host
static_kwargs = {}
cc = meson.get_compiler('c') cc = meson.get_compiler('c')
all_languages = ['c'] all_languages = ['c']
@ -515,7 +514,7 @@ gdbus_codegen = not_found
gdbus_codegen_error = '@0@ requires gdbus-codegen, please install libgio' gdbus_codegen_error = '@0@ requires gdbus-codegen, please install libgio'
if not get_option('gio').auto() or have_system if not get_option('gio').auto() or have_system
gio = dependency('gio-2.0', required: get_option('gio'), gio = dependency('gio-2.0', required: get_option('gio'),
method: 'pkg-config', kwargs: static_kwargs) method: 'pkg-config')
if gio.found() and not cc.links(''' if gio.found() and not cc.links('''
#include <gio/gio.h> #include <gio/gio.h>
int main(void) int main(void)
@ -532,7 +531,7 @@ if not get_option('gio').auto() or have_system
gdbus_codegen = find_program(gio.get_variable('gdbus_codegen'), gdbus_codegen = find_program(gio.get_variable('gdbus_codegen'),
required: get_option('gio')) required: get_option('gio'))
gio_unix = dependency('gio-unix-2.0', required: get_option('gio'), gio_unix = dependency('gio-unix-2.0', required: get_option('gio'),
method: 'pkg-config', kwargs: static_kwargs) method: 'pkg-config')
gio = declare_dependency(dependencies: [gio, gio_unix], gio = declare_dependency(dependencies: [gio, gio_unix],
version: gio.version()) version: gio.version())
endif endif
@ -545,20 +544,19 @@ endif
lttng = not_found lttng = not_found
if 'ust' in get_option('trace_backends') if 'ust' in get_option('trace_backends')
lttng = dependency('lttng-ust', required: true, version: '>= 2.1', lttng = dependency('lttng-ust', required: true, version: '>= 2.1',
method: 'pkg-config', kwargs: static_kwargs) method: 'pkg-config')
endif endif
pixman = not_found pixman = not_found
if have_system or have_tools if have_system or have_tools
pixman = dependency('pixman-1', required: have_system, version:'>=0.21.8', pixman = dependency('pixman-1', required: have_system, version:'>=0.21.8',
method: 'pkg-config', kwargs: static_kwargs) method: 'pkg-config')
endif endif
zlib = dependency('zlib', required: true, kwargs: static_kwargs) zlib = dependency('zlib', required: true)
libaio = not_found libaio = not_found
if not get_option('linux_aio').auto() or have_block if not get_option('linux_aio').auto() or have_block
libaio = cc.find_library('aio', has_headers: ['libaio.h'], libaio = cc.find_library('aio', has_headers: ['libaio.h'],
required: get_option('linux_aio'), required: get_option('linux_aio'))
kwargs: static_kwargs)
endif endif
linux_io_uring_test = ''' linux_io_uring_test = '''
@ -571,7 +569,7 @@ linux_io_uring = not_found
if not get_option('linux_io_uring').auto() or have_block if not get_option('linux_io_uring').auto() or have_block
linux_io_uring = dependency('liburing', version: '>=0.3', linux_io_uring = dependency('liburing', version: '>=0.3',
required: get_option('linux_io_uring'), required: get_option('linux_io_uring'),
method: 'pkg-config', kwargs: static_kwargs) method: 'pkg-config')
if not cc.links(linux_io_uring_test) if not cc.links(linux_io_uring_test)
linux_io_uring = not_found linux_io_uring = not_found
endif endif
@ -581,7 +579,7 @@ libnfs = not_found
if not get_option('libnfs').auto() or have_block if not get_option('libnfs').auto() or have_block
libnfs = dependency('libnfs', version: '>=1.9.3', libnfs = dependency('libnfs', version: '>=1.9.3',
required: get_option('libnfs'), required: get_option('libnfs'),
method: 'pkg-config', kwargs: static_kwargs) method: 'pkg-config')
endif endif
libattr_test = ''' libattr_test = '''
@ -601,8 +599,7 @@ if get_option('attr').allowed()
libattr = declare_dependency() libattr = declare_dependency()
else else
libattr = cc.find_library('attr', has_headers: ['attr/xattr.h'], libattr = cc.find_library('attr', has_headers: ['attr/xattr.h'],
required: get_option('attr'), required: get_option('attr'))
kwargs: static_kwargs)
if libattr.found() and not \ if libattr.found() and not \
cc.links(libattr_test, dependencies: libattr, args: '-DCONFIG_LIBATTR') cc.links(libattr_test, dependencies: libattr, args: '-DCONFIG_LIBATTR')
libattr = not_found libattr = not_found
@ -637,7 +634,7 @@ seccomp_has_sysrawrc = false
if not get_option('seccomp').auto() or have_system or have_tools if not get_option('seccomp').auto() or have_system or have_tools
seccomp = dependency('libseccomp', version: '>=2.3.0', seccomp = dependency('libseccomp', version: '>=2.3.0',
required: get_option('seccomp'), required: get_option('seccomp'),
method: 'pkg-config', kwargs: static_kwargs) method: 'pkg-config')
if seccomp.found() if seccomp.found()
seccomp_has_sysrawrc = cc.has_header_symbol('seccomp.h', seccomp_has_sysrawrc = cc.has_header_symbol('seccomp.h',
'SCMP_FLTATR_API_SYSRAWRC', 'SCMP_FLTATR_API_SYSRAWRC',
@ -648,8 +645,7 @@ endif
libcap_ng = not_found libcap_ng = not_found
if not get_option('cap_ng').auto() or have_system or have_tools if not get_option('cap_ng').auto() or have_system or have_tools
libcap_ng = cc.find_library('cap-ng', has_headers: ['cap-ng.h'], libcap_ng = cc.find_library('cap-ng', has_headers: ['cap-ng.h'],
required: get_option('cap_ng'), required: get_option('cap_ng'))
kwargs: static_kwargs)
endif endif
if libcap_ng.found() and not cc.links(''' if libcap_ng.found() and not cc.links('''
#include <cap-ng.h> #include <cap-ng.h>
@ -670,13 +666,13 @@ if get_option('xkbcommon').auto() and not have_system and not have_tools
xkbcommon = not_found xkbcommon = not_found
else else
xkbcommon = dependency('xkbcommon', required: get_option('xkbcommon'), xkbcommon = dependency('xkbcommon', required: get_option('xkbcommon'),
method: 'pkg-config', kwargs: static_kwargs) method: 'pkg-config')
endif endif
slirp = not_found slirp = not_found
if not get_option('slirp').auto() or have_system if not get_option('slirp').auto() or have_system
slirp = dependency('slirp', required: get_option('slirp'), slirp = dependency('slirp', required: get_option('slirp'),
method: 'pkg-config', kwargs: static_kwargs) method: 'pkg-config')
# slirp < 4.7 is incompatible with CFI support in QEMU. This is because # slirp < 4.7 is incompatible with CFI support in QEMU. This is because
# it passes function pointers within libslirp as callbacks for timers. # it passes function pointers within libslirp as callbacks for timers.
# When using a system-wide shared libslirp, the type information for the # When using a system-wide shared libslirp, the type information for the
@ -696,8 +692,7 @@ endif
vde = not_found vde = not_found
if not get_option('vde').auto() or have_system or have_tools if not get_option('vde').auto() or have_system or have_tools
vde = cc.find_library('vdeplug', has_headers: ['libvdeplug.h'], vde = cc.find_library('vdeplug', has_headers: ['libvdeplug.h'],
required: get_option('vde'), required: get_option('vde'))
kwargs: static_kwargs)
endif endif
if vde.found() and not cc.links(''' if vde.found() and not cc.links('''
#include <libvdeplug.h> #include <libvdeplug.h>
@ -719,41 +714,41 @@ endif
pulse = not_found pulse = not_found
if not get_option('pa').auto() or (targetos == 'linux' and have_system) if not get_option('pa').auto() or (targetos == 'linux' and have_system)
pulse = dependency('libpulse', required: get_option('pa'), pulse = dependency('libpulse', required: get_option('pa'),
method: 'pkg-config', kwargs: static_kwargs) method: 'pkg-config')
endif endif
alsa = not_found alsa = not_found
if not get_option('alsa').auto() or (targetos == 'linux' and have_system) if not get_option('alsa').auto() or (targetos == 'linux' and have_system)
alsa = dependency('alsa', required: get_option('alsa'), alsa = dependency('alsa', required: get_option('alsa'),
method: 'pkg-config', kwargs: static_kwargs) method: 'pkg-config')
endif endif
jack = not_found jack = not_found
if not get_option('jack').auto() or have_system if not get_option('jack').auto() or have_system
jack = dependency('jack', required: get_option('jack'), jack = dependency('jack', required: get_option('jack'),
method: 'pkg-config', kwargs: static_kwargs) method: 'pkg-config')
endif endif
pipewire = not_found pipewire = not_found
if not get_option('pipewire').auto() or (targetos == 'linux' and have_system) if not get_option('pipewire').auto() or (targetos == 'linux' and have_system)
pipewire = dependency('libpipewire-0.3', version: '>=0.3.60', pipewire = dependency('libpipewire-0.3', version: '>=0.3.60',
required: get_option('pipewire'), required: get_option('pipewire'),
method: 'pkg-config', kwargs: static_kwargs) method: 'pkg-config')
endif endif
sndio = not_found sndio = not_found
if not get_option('sndio').auto() or have_system if not get_option('sndio').auto() or have_system
sndio = dependency('sndio', required: get_option('sndio'), sndio = dependency('sndio', required: get_option('sndio'),
method: 'pkg-config', kwargs: static_kwargs) method: 'pkg-config')
endif endif
spice_protocol = not_found spice_protocol = not_found
if not get_option('spice_protocol').auto() or have_system if not get_option('spice_protocol').auto() or have_system
spice_protocol = dependency('spice-protocol', version: '>=0.14.0', spice_protocol = dependency('spice-protocol', version: '>=0.14.0',
required: get_option('spice_protocol'), required: get_option('spice_protocol'),
method: 'pkg-config', kwargs: static_kwargs) method: 'pkg-config')
endif endif
spice = not_found spice = not_found
if not get_option('spice').auto() or have_system if not get_option('spice').auto() or have_system
spice = dependency('spice-server', version: '>=0.14.0', spice = dependency('spice-server', version: '>=0.14.0',
required: get_option('spice'), required: get_option('spice'),
method: 'pkg-config', kwargs: static_kwargs) method: 'pkg-config')
endif endif
spice_headers = spice.partial_dependency(compile_args: true, includes: true) spice_headers = spice.partial_dependency(compile_args: true, includes: true)
@ -763,13 +758,13 @@ libiscsi = not_found
if not get_option('libiscsi').auto() or have_block if not get_option('libiscsi').auto() or have_block
libiscsi = dependency('libiscsi', version: '>=1.9.0', libiscsi = dependency('libiscsi', version: '>=1.9.0',
required: get_option('libiscsi'), required: get_option('libiscsi'),
method: 'pkg-config', kwargs: static_kwargs) method: 'pkg-config')
endif endif
zstd = not_found zstd = not_found
if not get_option('zstd').auto() or have_block if not get_option('zstd').auto() or have_block
zstd = dependency('libzstd', version: '>=1.4.0', zstd = dependency('libzstd', version: '>=1.4.0',
required: get_option('zstd'), required: get_option('zstd'),
method: 'pkg-config', kwargs: static_kwargs) method: 'pkg-config')
endif endif
virgl = not_found virgl = not_found
@ -777,29 +772,25 @@ have_vhost_user_gpu = have_tools and targetos == 'linux' and pixman.found()
if not get_option('virglrenderer').auto() or have_system or have_vhost_user_gpu if not get_option('virglrenderer').auto() or have_system or have_vhost_user_gpu
virgl = dependency('virglrenderer', virgl = dependency('virglrenderer',
method: 'pkg-config', method: 'pkg-config',
required: get_option('virglrenderer'), required: get_option('virglrenderer'))
kwargs: static_kwargs)
endif endif
blkio = not_found blkio = not_found
if not get_option('blkio').auto() or have_block if not get_option('blkio').auto() or have_block
blkio = dependency('blkio', blkio = dependency('blkio',
method: 'pkg-config', method: 'pkg-config',
required: get_option('blkio'), required: get_option('blkio'))
kwargs: static_kwargs)
endif endif
curl = not_found curl = not_found
if not get_option('curl').auto() or have_block if not get_option('curl').auto() or have_block
curl = dependency('libcurl', version: '>=7.29.0', curl = dependency('libcurl', version: '>=7.29.0',
method: 'pkg-config', method: 'pkg-config',
required: get_option('curl'), required: get_option('curl'))
kwargs: static_kwargs)
endif endif
libudev = not_found libudev = not_found
if targetos == 'linux' and (have_system or have_tools) if targetos == 'linux' and (have_system or have_tools)
libudev = dependency('libudev', libudev = dependency('libudev',
method: 'pkg-config', method: 'pkg-config',
required: get_option('libudev'), required: get_option('libudev'))
kwargs: static_kwargs)
endif endif
mpathlibs = [libudev] mpathlibs = [libudev]
@ -834,18 +825,15 @@ if targetos == 'linux' and have_tools and get_option('mpath').allowed()
return 0; return 0;
}''' }'''
libmpathpersist = cc.find_library('mpathpersist', libmpathpersist = cc.find_library('mpathpersist',
required: get_option('mpath'), required: get_option('mpath'))
kwargs: static_kwargs)
if libmpathpersist.found() if libmpathpersist.found()
mpathlibs += libmpathpersist mpathlibs += libmpathpersist
if get_option('prefer_static') if get_option('prefer_static')
mpathlibs += cc.find_library('devmapper', mpathlibs += cc.find_library('devmapper',
required: get_option('mpath'), required: get_option('mpath'))
kwargs: static_kwargs)
endif endif
mpathlibs += cc.find_library('multipath', mpathlibs += cc.find_library('multipath',
required: get_option('mpath'), required: get_option('mpath'))
kwargs: static_kwargs)
foreach lib: mpathlibs foreach lib: mpathlibs
if not lib.found() if not lib.found()
mpathlibs = [] mpathlibs = []
@ -895,8 +883,7 @@ if have_system and get_option('curses').allowed()
curses_dep_list = targetos == 'windows' ? ['ncurses', 'ncursesw'] : ['ncursesw'] curses_dep_list = targetos == 'windows' ? ['ncurses', 'ncursesw'] : ['ncursesw']
curses = dependency(curses_dep_list, curses = dependency(curses_dep_list,
required: false, required: false,
method: 'pkg-config', method: 'pkg-config')
kwargs: static_kwargs)
msg = get_option('curses').enabled() ? 'curses library not found' : '' msg = get_option('curses').enabled() ? 'curses library not found' : ''
curses_compile_args = ['-DNCURSES_WIDECHAR=1'] curses_compile_args = ['-DNCURSES_WIDECHAR=1']
if curses.found() if curses.found()
@ -918,8 +905,7 @@ if have_system and get_option('curses').allowed()
curses_libname_list = (targetos == 'windows' ? ['pdcurses'] : ['ncursesw', 'cursesw']) curses_libname_list = (targetos == 'windows' ? ['pdcurses'] : ['ncursesw', 'cursesw'])
foreach curses_libname : curses_libname_list foreach curses_libname : curses_libname_list
libcurses = cc.find_library(curses_libname, libcurses = cc.find_library(curses_libname,
required: false, required: false)
kwargs: static_kwargs)
if libcurses.found() if libcurses.found()
if cc.links(curses_test, args: curses_compile_args, dependencies: libcurses) if cc.links(curses_test, args: curses_compile_args, dependencies: libcurses)
curses = declare_dependency(compile_args: curses_compile_args, curses = declare_dependency(compile_args: curses_compile_args,
@ -969,8 +955,7 @@ endif
brlapi = not_found brlapi = not_found
if not get_option('brlapi').auto() or have_system if not get_option('brlapi').auto() or have_system
brlapi = cc.find_library('brlapi', has_headers: ['brlapi.h'], brlapi = cc.find_library('brlapi', has_headers: ['brlapi.h'],
required: get_option('brlapi'), required: get_option('brlapi'))
kwargs: static_kwargs)
if brlapi.found() and not cc.links(''' if brlapi.found() and not cc.links('''
#include <brlapi.h> #include <brlapi.h>
#include <stddef.h> #include <stddef.h>
@ -986,7 +971,7 @@ endif
sdl = not_found sdl = not_found
if not get_option('sdl').auto() or have_system if not get_option('sdl').auto() or have_system
sdl = dependency('sdl2', required: get_option('sdl'), kwargs: static_kwargs) sdl = dependency('sdl2', required: get_option('sdl'))
sdl_image = not_found sdl_image = not_found
endif endif
if sdl.found() if sdl.found()
@ -994,7 +979,7 @@ if sdl.found()
sdl = declare_dependency(compile_args: '-Wno-undef', sdl = declare_dependency(compile_args: '-Wno-undef',
dependencies: sdl) dependencies: sdl)
sdl_image = dependency('SDL2_image', required: get_option('sdl_image'), sdl_image = dependency('SDL2_image', required: get_option('sdl_image'),
method: 'pkg-config', kwargs: static_kwargs) method: 'pkg-config')
else else
if get_option('sdl_image').enabled() if get_option('sdl_image').enabled()
error('sdl-image required, but SDL was @0@'.format( error('sdl-image required, but SDL was @0@'.format(
@ -1005,11 +990,9 @@ endif
rbd = not_found rbd = not_found
if not get_option('rbd').auto() or have_block if not get_option('rbd').auto() or have_block
librados = cc.find_library('rados', required: get_option('rbd'), librados = cc.find_library('rados', required: get_option('rbd'))
kwargs: static_kwargs)
librbd = cc.find_library('rbd', has_headers: ['rbd/librbd.h'], librbd = cc.find_library('rbd', has_headers: ['rbd/librbd.h'],
required: get_option('rbd'), required: get_option('rbd'))
kwargs: static_kwargs)
if librados.found() and librbd.found() if librados.found() and librbd.found()
if cc.links(''' if cc.links('''
#include <stdio.h> #include <stdio.h>
@ -1037,7 +1020,7 @@ glusterfs_iocb_has_stat = false
if not get_option('glusterfs').auto() or have_block if not get_option('glusterfs').auto() or have_block
glusterfs = dependency('glusterfs-api', version: '>=3', glusterfs = dependency('glusterfs-api', version: '>=3',
required: get_option('glusterfs'), required: get_option('glusterfs'),
method: 'pkg-config', kwargs: static_kwargs) method: 'pkg-config')
if glusterfs.found() if glusterfs.found()
glusterfs_ftruncate_has_stat = cc.links(''' glusterfs_ftruncate_has_stat = cc.links('''
#include <glusterfs/api/glfs.h> #include <glusterfs/api/glfs.h>
@ -1072,15 +1055,13 @@ libssh = not_found
if not get_option('libssh').auto() or have_block if not get_option('libssh').auto() or have_block
libssh = dependency('libssh', version: '>=0.8.7', libssh = dependency('libssh', version: '>=0.8.7',
method: 'pkg-config', method: 'pkg-config',
required: get_option('libssh'), required: get_option('libssh'))
kwargs: static_kwargs)
endif endif
libbzip2 = not_found libbzip2 = not_found
if not get_option('bzip2').auto() or have_block if not get_option('bzip2').auto() or have_block
libbzip2 = cc.find_library('bz2', has_headers: ['bzlib.h'], libbzip2 = cc.find_library('bz2', has_headers: ['bzlib.h'],
required: get_option('bzip2'), required: get_option('bzip2'))
kwargs: static_kwargs)
if libbzip2.found() and not cc.links(''' if libbzip2.found() and not cc.links('''
#include <bzlib.h> #include <bzlib.h>
int main(void) { BZ2_bzlibVersion(); return 0; }''', dependencies: libbzip2) int main(void) { BZ2_bzlibVersion(); return 0; }''', dependencies: libbzip2)
@ -1096,8 +1077,7 @@ endif
liblzfse = not_found liblzfse = not_found
if not get_option('lzfse').auto() or have_block if not get_option('lzfse').auto() or have_block
liblzfse = cc.find_library('lzfse', has_headers: ['lzfse.h'], liblzfse = cc.find_library('lzfse', has_headers: ['lzfse.h'],
required: get_option('lzfse'), required: get_option('lzfse'))
kwargs: static_kwargs)
endif endif
if liblzfse.found() and not cc.links(''' if liblzfse.found() and not cc.links('''
#include <lzfse.h> #include <lzfse.h>
@ -1115,8 +1095,7 @@ if get_option('oss').allowed() and have_system
if not cc.has_header('sys/soundcard.h') if not cc.has_header('sys/soundcard.h')
# not found # not found
elif targetos == 'netbsd' elif targetos == 'netbsd'
oss = cc.find_library('ossaudio', required: get_option('oss'), oss = cc.find_library('ossaudio', required: get_option('oss'))
kwargs: static_kwargs)
else else
oss = declare_dependency() oss = declare_dependency()
endif endif
@ -1149,7 +1128,7 @@ endif
opengl = not_found opengl = not_found
if not get_option('opengl').auto() or have_system or have_vhost_user_gpu if not get_option('opengl').auto() or have_system or have_vhost_user_gpu
epoxy = dependency('epoxy', method: 'pkg-config', epoxy = dependency('epoxy', method: 'pkg-config',
required: get_option('opengl'), kwargs: static_kwargs) required: get_option('opengl'))
if cc.has_header('epoxy/egl.h', dependencies: epoxy) if cc.has_header('epoxy/egl.h', dependencies: epoxy)
opengl = epoxy opengl = epoxy
elif get_option('opengl').enabled() elif get_option('opengl').enabled()
@ -1158,8 +1137,7 @@ if not get_option('opengl').auto() or have_system or have_vhost_user_gpu
endif endif
gbm = not_found gbm = not_found
if (have_system or have_tools) and (virgl.found() or opengl.found()) if (have_system or have_tools) and (virgl.found() or opengl.found())
gbm = dependency('gbm', method: 'pkg-config', required: false, gbm = dependency('gbm', method: 'pkg-config', required: false)
kwargs: static_kwargs)
endif endif
have_vhost_user_gpu = have_vhost_user_gpu and virgl.found() and opengl.found() and gbm.found() have_vhost_user_gpu = have_vhost_user_gpu and virgl.found() and opengl.found() and gbm.found()
@ -1181,16 +1159,14 @@ if get_option('gnutls').enabled() or (get_option('gnutls').auto() and have_syste
# the platform support requirements # the platform support requirements
gnutls_crypto = dependency('gnutls', version: '>=3.6.14', gnutls_crypto = dependency('gnutls', version: '>=3.6.14',
method: 'pkg-config', method: 'pkg-config',
required: false, required: false)
kwargs: static_kwargs)
if gnutls_crypto.found() if gnutls_crypto.found()
gnutls = gnutls_crypto gnutls = gnutls_crypto
else else
# Our min version if all we need is TLS # Our min version if all we need is TLS
gnutls = dependency('gnutls', version: '>=3.5.18', gnutls = dependency('gnutls', version: '>=3.5.18',
method: 'pkg-config', method: 'pkg-config',
required: get_option('gnutls'), required: get_option('gnutls'))
kwargs: static_kwargs)
endif endif
endif endif
@ -1217,34 +1193,31 @@ if not gnutls_crypto.found()
if (not get_option('gcrypt').auto() or have_system) and not get_option('nettle').enabled() if (not get_option('gcrypt').auto() or have_system) and not get_option('nettle').enabled()
gcrypt = dependency('libgcrypt', version: '>=1.8', gcrypt = dependency('libgcrypt', version: '>=1.8',
method: 'config-tool', method: 'config-tool',
required: get_option('gcrypt'), required: get_option('gcrypt'))
kwargs: static_kwargs)
# Debian has removed -lgpg-error from libgcrypt-config # Debian has removed -lgpg-error from libgcrypt-config
# as it "spreads unnecessary dependencies" which in # as it "spreads unnecessary dependencies" which in
# turn breaks static builds... # turn breaks static builds...
if gcrypt.found() and get_option('prefer_static') if gcrypt.found() and get_option('prefer_static')
gcrypt = declare_dependency(dependencies: [ gcrypt = declare_dependency(dependencies: [
gcrypt, gcrypt,
cc.find_library('gpg-error', required: true, kwargs: static_kwargs)]) cc.find_library('gpg-error', required: true)])
endif endif
endif endif
if (not get_option('nettle').auto() or have_system) and not gcrypt.found() if (not get_option('nettle').auto() or have_system) and not gcrypt.found()
nettle = dependency('nettle', version: '>=3.4', nettle = dependency('nettle', version: '>=3.4',
method: 'pkg-config', method: 'pkg-config',
required: get_option('nettle'), required: get_option('nettle'))
kwargs: static_kwargs)
if nettle.found() and not cc.has_header('nettle/xts.h', dependencies: nettle) if nettle.found() and not cc.has_header('nettle/xts.h', dependencies: nettle)
xts = 'private' xts = 'private'
endif endif
endif endif
endif endif
gmp = dependency('gmp', required: false, method: 'pkg-config', kwargs: static_kwargs) gmp = dependency('gmp', required: false, method: 'pkg-config')
if nettle.found() and gmp.found() if nettle.found() and gmp.found()
hogweed = dependency('hogweed', version: '>=3.4', hogweed = dependency('hogweed', version: '>=3.4',
method: 'pkg-config', method: 'pkg-config',
required: get_option('nettle'), required: get_option('nettle'))
kwargs: static_kwargs)
endif endif
@ -1256,20 +1229,17 @@ have_gtk_clipboard = get_option('gtk_clipboard').enabled()
if not get_option('gtk').auto() or have_system if not get_option('gtk').auto() or have_system
gtk = dependency('gtk+-3.0', version: '>=3.22.0', gtk = dependency('gtk+-3.0', version: '>=3.22.0',
method: 'pkg-config', method: 'pkg-config',
required: get_option('gtk'), required: get_option('gtk'))
kwargs: static_kwargs)
if gtk.found() if gtk.found()
gtkx11 = dependency('gtk+-x11-3.0', version: '>=3.22.0', gtkx11 = dependency('gtk+-x11-3.0', version: '>=3.22.0',
method: 'pkg-config', method: 'pkg-config',
required: false, required: false)
kwargs: static_kwargs)
gtk = declare_dependency(dependencies: [gtk, gtkx11]) gtk = declare_dependency(dependencies: [gtk, gtkx11])
if not get_option('vte').auto() or have_system if not get_option('vte').auto() or have_system
vte = dependency('vte-2.91', vte = dependency('vte-2.91',
method: 'pkg-config', method: 'pkg-config',
required: get_option('vte'), required: get_option('vte'))
kwargs: static_kwargs)
endif endif
elif have_gtk_clipboard elif have_gtk_clipboard
error('GTK clipboard requested, but GTK not found') error('GTK clipboard requested, but GTK not found')
@ -1278,13 +1248,12 @@ endif
x11 = not_found x11 = not_found
if gtkx11.found() if gtkx11.found()
x11 = dependency('x11', method: 'pkg-config', required: gtkx11.found(), x11 = dependency('x11', method: 'pkg-config', required: gtkx11.found())
kwargs: static_kwargs)
endif endif
png = not_found png = not_found
if get_option('png').allowed() and have_system if get_option('png').allowed() and have_system
png = dependency('libpng', version: '>=1.6.34', required: get_option('png'), png = dependency('libpng', version: '>=1.6.34', required: get_option('png'),
method: 'pkg-config', kwargs: static_kwargs) method: 'pkg-config')
endif endif
vnc = not_found vnc = not_found
jpeg = not_found jpeg = not_found
@ -1292,10 +1261,9 @@ sasl = not_found
if get_option('vnc').allowed() and have_system if get_option('vnc').allowed() and have_system
vnc = declare_dependency() # dummy dependency vnc = declare_dependency() # dummy dependency
jpeg = dependency('libjpeg', required: get_option('vnc_jpeg'), jpeg = dependency('libjpeg', required: get_option('vnc_jpeg'),
method: 'pkg-config', kwargs: static_kwargs) method: 'pkg-config')
sasl = cc.find_library('sasl2', has_headers: ['sasl/sasl.h'], sasl = cc.find_library('sasl2', has_headers: ['sasl/sasl.h'],
required: get_option('vnc_sasl'), required: get_option('vnc_sasl'))
kwargs: static_kwargs)
if sasl.found() if sasl.found()
sasl = declare_dependency(dependencies: sasl, sasl = declare_dependency(dependencies: sasl,
compile_args: '-DSTRUCT_IOVEC_DEFINED') compile_args: '-DSTRUCT_IOVEC_DEFINED')
@ -1305,8 +1273,7 @@ endif
pam = not_found pam = not_found
if not get_option('auth_pam').auto() or have_system if not get_option('auth_pam').auto() or have_system
pam = cc.find_library('pam', has_headers: ['security/pam_appl.h'], pam = cc.find_library('pam', has_headers: ['security/pam_appl.h'],
required: get_option('auth_pam'), required: get_option('auth_pam'))
kwargs: static_kwargs)
endif endif
if pam.found() and not cc.links(''' if pam.found() and not cc.links('''
#include <stddef.h> #include <stddef.h>
@ -1330,8 +1297,7 @@ endif
snappy = not_found snappy = not_found
if not get_option('snappy').auto() or have_system if not get_option('snappy').auto() or have_system
snappy = cc.find_library('snappy', has_headers: ['snappy-c.h'], snappy = cc.find_library('snappy', has_headers: ['snappy-c.h'],
required: get_option('snappy'), required: get_option('snappy'))
kwargs: static_kwargs)
endif endif
if snappy.found() and not linker.links(''' if snappy.found() and not linker.links('''
#include <snappy-c.h> #include <snappy-c.h>
@ -1347,8 +1313,7 @@ endif
lzo = not_found lzo = not_found
if not get_option('lzo').auto() or have_system if not get_option('lzo').auto() or have_system
lzo = cc.find_library('lzo2', has_headers: ['lzo/lzo1x.h'], lzo = cc.find_library('lzo2', has_headers: ['lzo/lzo1x.h'],
required: get_option('lzo'), required: get_option('lzo'))
kwargs: static_kwargs)
endif endif
if lzo.found() and not cc.links(''' if lzo.found() and not cc.links('''
#include <lzo/lzo1x.h> #include <lzo/lzo1x.h>
@ -1364,8 +1329,7 @@ endif
numa = not_found numa = not_found
if not get_option('numa').auto() or have_system or have_tools if not get_option('numa').auto() or have_system or have_tools
numa = cc.find_library('numa', has_headers: ['numa.h'], numa = cc.find_library('numa', has_headers: ['numa.h'],
required: get_option('numa'), required: get_option('numa'))
kwargs: static_kwargs)
endif endif
if numa.found() and not cc.links(''' if numa.found() and not cc.links('''
#include <numa.h> #include <numa.h>
@ -1383,10 +1347,8 @@ rdma = not_found
if not get_option('rdma').auto() or have_system if not get_option('rdma').auto() or have_system
libumad = cc.find_library('ibumad', required: get_option('rdma')) libumad = cc.find_library('ibumad', required: get_option('rdma'))
rdma_libs = [cc.find_library('rdmacm', has_headers: ['rdma/rdma_cma.h'], rdma_libs = [cc.find_library('rdmacm', has_headers: ['rdma/rdma_cma.h'],
required: get_option('rdma'), required: get_option('rdma')),
kwargs: static_kwargs), cc.find_library('ibverbs', required: get_option('rdma')),
cc.find_library('ibverbs', required: get_option('rdma'),
kwargs: static_kwargs),
libumad] libumad]
rdma = declare_dependency(dependencies: rdma_libs) rdma = declare_dependency(dependencies: rdma_libs)
foreach lib: rdma_libs foreach lib: rdma_libs
@ -1399,30 +1361,30 @@ endif
xen = not_found xen = not_found
if get_option('xen').enabled() or (get_option('xen').auto() and have_system) if get_option('xen').enabled() or (get_option('xen').auto() and have_system)
xencontrol = dependency('xencontrol', required: false, xencontrol = dependency('xencontrol', required: false,
method: 'pkg-config', kwargs: static_kwargs) method: 'pkg-config')
if xencontrol.found() if xencontrol.found()
xen_pc = declare_dependency(version: xencontrol.version(), xen_pc = declare_dependency(version: xencontrol.version(),
dependencies: [ dependencies: [
xencontrol, xencontrol,
# disabler: true makes xen_pc.found() return false if any is not found # disabler: true makes xen_pc.found() return false if any is not found
dependency('xenstore', required: false, dependency('xenstore', required: false,
method: 'pkg-config', kwargs: static_kwargs, method: 'pkg-config',
disabler: true), disabler: true),
dependency('xenforeignmemory', required: false, dependency('xenforeignmemory', required: false,
method: 'pkg-config', kwargs: static_kwargs, method: 'pkg-config',
disabler: true), disabler: true),
dependency('xengnttab', required: false, dependency('xengnttab', required: false,
method: 'pkg-config', kwargs: static_kwargs, method: 'pkg-config',
disabler: true), disabler: true),
dependency('xenevtchn', required: false, dependency('xenevtchn', required: false,
method: 'pkg-config', kwargs: static_kwargs, method: 'pkg-config',
disabler: true), disabler: true),
dependency('xendevicemodel', required: false, dependency('xendevicemodel', required: false,
method: 'pkg-config', kwargs: static_kwargs, method: 'pkg-config',
disabler: true), disabler: true),
# optional, no "disabler: true" # optional, no "disabler: true"
dependency('xentoolcore', required: false, dependency('xentoolcore', required: false,
method: 'pkg-config', kwargs: static_kwargs)]) method: 'pkg-config')])
if xen_pc.found() if xen_pc.found()
xen = xen_pc xen = xen_pc
endif endif
@ -1480,60 +1442,53 @@ have_xen_pci_passthrough = get_option('xen_pci_passthrough') \
cacard = not_found cacard = not_found
if not get_option('smartcard').auto() or have_system if not get_option('smartcard').auto() or have_system
cacard = dependency('libcacard', required: get_option('smartcard'), cacard = dependency('libcacard', required: get_option('smartcard'),
version: '>=2.5.1', method: 'pkg-config', version: '>=2.5.1', method: 'pkg-config')
kwargs: static_kwargs)
endif endif
u2f = not_found u2f = not_found
if have_system if have_system
u2f = dependency('u2f-emu', required: get_option('u2f'), u2f = dependency('u2f-emu', required: get_option('u2f'),
method: 'pkg-config', method: 'pkg-config')
kwargs: static_kwargs)
endif endif
canokey = not_found canokey = not_found
if have_system if have_system
canokey = dependency('canokey-qemu', required: get_option('canokey'), canokey = dependency('canokey-qemu', required: get_option('canokey'),
method: 'pkg-config', method: 'pkg-config')
kwargs: static_kwargs)
endif endif
usbredir = not_found usbredir = not_found
if not get_option('usb_redir').auto() or have_system if not get_option('usb_redir').auto() or have_system
usbredir = dependency('libusbredirparser-0.5', required: get_option('usb_redir'), usbredir = dependency('libusbredirparser-0.5', required: get_option('usb_redir'),
version: '>=0.6', method: 'pkg-config', version: '>=0.6', method: 'pkg-config')
kwargs: static_kwargs)
endif endif
libusb = not_found libusb = not_found
if not get_option('libusb').auto() or have_system if not get_option('libusb').auto() or have_system
libusb = dependency('libusb-1.0', required: get_option('libusb'), libusb = dependency('libusb-1.0', required: get_option('libusb'),
version: '>=1.0.13', method: 'pkg-config', version: '>=1.0.13', method: 'pkg-config')
kwargs: static_kwargs)
endif endif
libpmem = not_found libpmem = not_found
if not get_option('libpmem').auto() or have_system if not get_option('libpmem').auto() or have_system
libpmem = dependency('libpmem', required: get_option('libpmem'), libpmem = dependency('libpmem', required: get_option('libpmem'),
method: 'pkg-config', kwargs: static_kwargs) method: 'pkg-config')
endif endif
libdaxctl = not_found libdaxctl = not_found
if not get_option('libdaxctl').auto() or have_system if not get_option('libdaxctl').auto() or have_system
libdaxctl = dependency('libdaxctl', required: get_option('libdaxctl'), libdaxctl = dependency('libdaxctl', required: get_option('libdaxctl'),
version: '>=57', method: 'pkg-config', version: '>=57', method: 'pkg-config')
kwargs: static_kwargs)
endif endif
tasn1 = not_found tasn1 = not_found
if gnutls.found() if gnutls.found()
tasn1 = dependency('libtasn1', tasn1 = dependency('libtasn1',
method: 'pkg-config', method: 'pkg-config')
kwargs: static_kwargs)
endif endif
keyutils = dependency('libkeyutils', required: false, keyutils = dependency('libkeyutils', required: false,
method: 'pkg-config', kwargs: static_kwargs) method: 'pkg-config')
has_gettid = cc.has_function('gettid') has_gettid = cc.has_function('gettid')
# libselinux # libselinux
selinux = dependency('libselinux', selinux = dependency('libselinux',
required: get_option('selinux'), required: get_option('selinux'),
method: 'pkg-config', kwargs: static_kwargs) method: 'pkg-config')
# Malloc tests # Malloc tests
@ -1597,8 +1552,7 @@ if get_option('fuse').disabled() and get_option('fuse_lseek').enabled()
endif endif
fuse = dependency('fuse3', required: get_option('fuse'), fuse = dependency('fuse3', required: get_option('fuse'),
version: '>=3.1', method: 'pkg-config', version: '>=3.1', method: 'pkg-config')
kwargs: static_kwargs)
fuse_lseek = not_found fuse_lseek = not_found
if get_option('fuse_lseek').allowed() if get_option('fuse_lseek').allowed()
@ -1657,7 +1611,6 @@ if not get_option('libdw').auto() or \
(not get_option('prefer_static') and (have_system or have_user)) (not get_option('prefer_static') and (have_system or have_user))
libdw = dependency('libdw', libdw = dependency('libdw',
method: 'pkg-config', method: 'pkg-config',
kwargs: static_kwargs,
required: get_option('libdw')) required: get_option('libdw'))
endif endif
@ -2758,7 +2711,7 @@ genh += custom_target('config-poison.h',
capstone = not_found capstone = not_found
if not get_option('capstone').auto() or have_system or have_user if not get_option('capstone').auto() or have_system or have_user
capstone = dependency('capstone', version: '>=3.0.5', capstone = dependency('capstone', version: '>=3.0.5',
kwargs: static_kwargs, method: 'pkg-config', method: 'pkg-config',
required: get_option('capstone')) required: get_option('capstone'))
# Some versions of capstone have broken pkg-config file # Some versions of capstone have broken pkg-config file
@ -2794,7 +2747,7 @@ if have_system
fdt_opt = get_option('fdt') fdt_opt = get_option('fdt')
if fdt_opt in ['enabled', 'auto', 'system'] if fdt_opt in ['enabled', 'auto', 'system']
have_internal = fs.exists(meson.current_source_dir() / 'dtc/libfdt/Makefile.libfdt') have_internal = fs.exists(meson.current_source_dir() / 'dtc/libfdt/Makefile.libfdt')
fdt = cc.find_library('fdt', kwargs: static_kwargs, fdt = cc.find_library('fdt',
required: fdt_opt == 'system' or required: fdt_opt == 'system' or
fdt_opt == 'enabled' and not have_internal) fdt_opt == 'enabled' and not have_internal)
if fdt.found() and cc.links(''' if fdt.found() and cc.links('''

View file

@ -13,7 +13,7 @@ tcg_ss.add(files(
if get_option('tcg_interpreter') if get_option('tcg_interpreter')
libffi = dependency('libffi', version: '>=3.0', required: true, libffi = dependency('libffi', version: '>=3.0', required: true,
method: 'pkg-config', kwargs: static_kwargs) method: 'pkg-config')
specific_ss.add(libffi) specific_ss.add(libffi)
specific_ss.add(files('tci.c')) specific_ss.add(files('tci.c'))
endif endif