From e06638d665e1b4ac85feea88c53113cb877c460d Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Mon, 17 Feb 2020 12:02:44 -0800 Subject: [PATCH] build: make libunwind optional --- meson.build | 8 +++++--- meson_options.txt | 3 +++ src/libsysprof/preload/meson.build | 5 ++++- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/meson.build b/meson.build index 13ef5a4f..231445d9 100644 --- a/meson.build +++ b/meson.build @@ -89,9 +89,11 @@ if cc.has_header('execinfo.h') config_h.set10('HAVE_EXECINFO_H', true) endif -libunwind_dep = dependency('libunwind-generic', required: false) -if libunwind_dep.found() - config_h.set10('ENABLE_LIBUNWIND', libunwind_dep.found()) +if get_option('libunwind') + libunwind_dep = dependency('libunwind-generic', required: false) + if libunwind_dep.found() + config_h.set10('ENABLE_LIBUNWIND', libunwind_dep.found()) + endif endif # Development build setup diff --git a/meson_options.txt b/meson_options.txt index f30c7834..623945c7 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -29,3 +29,6 @@ option('debugdir', type: 'string', # If Yelp documentation should be installed option('help', type: 'boolean') + +# Disable use of libunwind +option('libunwind', type: 'boolean') diff --git a/src/libsysprof/preload/meson.build b/src/libsysprof/preload/meson.build index 596fc799..91b09a0e 100644 --- a/src/libsysprof/preload/meson.build +++ b/src/libsysprof/preload/meson.build @@ -1,9 +1,12 @@ libsysprof_memory_preload_deps = [ cc.find_library('dl', required: false), libsysprof_capture_dep, - libunwind_dep, ] +if get_option('libunwind') + libsysprof_memory_preload_deps += [libunwind_dep] +endif + libsysprof_memory_preload_sources = [ 'sysprof-memory-collector.c', ]