meson: Add an option to disable usage of libunwind
authorThibault Saunier <thibault.saunier@osg.samsung.com>
Mon, 13 Feb 2017 18:18:59 +0000 (15:18 -0300)
committerThibault Saunier <thibault.saunier@osg.samsung.com>
Fri, 24 Feb 2017 19:16:23 +0000 (16:16 -0300)
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=778193

gst/meson.build
meson.build
meson_options.txt

index aa8dd93..1cd8815 100644 (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
index 9f4476c..e7d219b 100644 (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)
-  else
-    message('Support for backtraces is partial only.')
-  endif
-else
-  if cc.has_function('backtrace')
-    cdata.set('HAVE_BACKTRACE', 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('NO backtraces support.')
+    if cc.has_function('backtrace')
+      cdata.set('HAVE_BACKTRACE', 1)
+    else
+        message('NO backtraces support.')
+    endif
   endif
 endif
 
index 190fe1b..9bc0e29 100644 (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)')