diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2022-10-12 13:19:35 +0200 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2023-05-18 08:53:52 +0200 |
commit | 6739825aa6e432fdb668e842def12c5deb3e5bad (patch) | |
tree | 5988d5fd30070826da2bef77a9058494058044a6 /meson.build | |
parent | 721fa5e563e8174d6c33e1e413cebb5442625932 (diff) | |
download | qemu-6739825aa6e432fdb668e842def12c5deb3e5bad.zip qemu-6739825aa6e432fdb668e842def12c5deb3e5bad.tar.gz qemu-6739825aa6e432fdb668e842def12c5deb3e5bad.tar.bz2 |
build: move coroutine backend selection to meson
To simplify the code, rename coroutine-win32.c to match the option
passed to configure.
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.build | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/meson.build b/meson.build index 22eaca1..130dfab 100644 --- a/meson.build +++ b/meson.build @@ -211,6 +211,34 @@ if get_option('prefer_static') qemu_ldflags += get_option('b_pie') ? '-static-pie' : '-static' endif +coroutine_backend = get_option('coroutine_backend') +ucontext_probe = ''' + #include <ucontext.h> + #ifdef __stub_makecontext + #error Ignoring glibc stub makecontext which will always fail + #endif + int main(void) { makecontext(0, 0, 0); return 0; }''' + +# On Windows the only valid backend is the Windows specific one. +# For POSIX prefer ucontext, but it's not always possible. The fallback +# is sigcontext. +supported_backends = [] +if targetos == 'windows' + supported_backends += ['windows'] +else + if targetos != 'darwin' and cc.links(ucontext_probe) + supported_backends += ['ucontext'] + endif + supported_backends += ['sigaltstack'] +endif + +if coroutine_backend == 'auto' + coroutine_backend = supported_backends[0] +elif coroutine_backend not in supported_backends + error('"@0@" backend requested but not available. Available backends: @1@' \ + .format(coroutine_backend, ', '.join(supported_backends))) +endif + # Compiles if SafeStack *not* enabled safe_stack_probe = ''' int main(void) @@ -232,7 +260,7 @@ if get_option('safe_stack') != not cc.compiles(safe_stack_probe) qemu_cflags += safe_stack_arg qemu_ldflags += safe_stack_arg endif -if get_option('safe_stack') and config_host['CONFIG_COROUTINE_BACKEND'] != 'ucontext' +if get_option('safe_stack') and coroutine_backend != 'ucontext' error('SafeStack is only supported with the ucontext coroutine backend') endif @@ -4037,7 +4065,7 @@ summary(summary_info, bool_yn: true, section: 'Targets and accelerators') # Block layer summary_info = {} -summary_info += {'coroutine backend': config_host['CONFIG_COROUTINE_BACKEND']} +summary_info += {'coroutine backend': coroutine_backend} summary_info += {'coroutine pool': have_coroutine_pool} if have_block summary_info += {'Block whitelist (rw)': get_option('block_drv_rw_whitelist')} |