meson: Add an option to disable usage of libunwind

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=778193
This commit is contained in:
Thibault Saunier 2017-02-13 15:18:59 -03:00
parent 3a3d688c33
commit d6dba3fd6f
3 changed files with 23 additions and 16 deletions

View file

@ -196,7 +196,7 @@ if libtype != 'shared'
include_directories('parse')],
install : true,
link_with : printf_lib,
dependencies : [gobject_dep, gmodule_dep, glib_dep, mathlib, unwind_dep, dw_dep] + platform_deps,
dependencies : [gobject_dep, gmodule_dep, glib_dep, mathlib] + backtrace_deps + platform_deps,
)
libgst = libgst_static
endif
@ -215,8 +215,8 @@ if libtype != 'static'
include_directories('parse')],
link_with : printf_lib,
install : true,
dependencies : [gobject_dep, gmodule_dep, glib_dep, mathlib, dl_dep,
unwind_dep, dw_dep] + platform_deps,
dependencies : [gobject_dep, gmodule_dep, glib_dep, mathlib, dl_dep] + backtrace_deps
+ platform_deps,
vs_module_defs: vs_module_defs_dir + 'libgstreamer.def',
)
libgst = libgst_shared

View file

@ -275,20 +275,24 @@ if host_machine.system() == 'windows'
platform_deps = [cc.find_library('ws2_32')]
endif
unwind_dep = dependency('libunwind', required : false)
dw_dep = dependency('libdw', required: false)
if unwind_dep.found()
cdata.set('HAVE_UNWIND', 1)
if dw_dep.found()
cdata.set('HAVE_DW', 1)
backtrace_deps = []
if not get_option('disable_libunwind')
unwind_dep = dependency('libunwind', required : false)
dw_dep = dependency('libdw', required: false)
backtrace_deps = [unwind_dep, dw_dep]
if unwind_dep.found()
cdata.set('HAVE_UNWIND', 1)
if dw_dep.found()
cdata.set('HAVE_DW', 1)
else
message('Support for backtraces is partial only.')
endif
else
message('Support for backtraces is partial only.')
endif
else
if cc.has_function('backtrace')
cdata.set('HAVE_BACKTRACE', 1)
else
message('NO backtraces support.')
if cc.has_function('backtrace')
cdata.set('HAVE_BACKTRACE', 1)
else
message('NO backtraces support.')
endif
endif
endif

View file

@ -8,3 +8,6 @@ option('library_format', type : 'combo', choices : ['shared', 'static', 'both'],
option('disable_introspection',
type : 'boolean', value : false,
description : 'Whether to disable the introspection generation')
option('disable_libunwind',
type : 'boolean', value : false,
description : 'Whether to disable the usage of libunwind (to generate backtraces)')