summaryrefslogtreecommitdiffstats
path: root/meta/recipes-multimedia/gstreamer/gstreamer1.0/0003-meson-Add-valgrind-feature.patch
blob: f553340f4d14699dc8b21d8bc0c3a708896a7a23 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
From f6c7973c03d9ba7dab60c496e768c5e6c4ee824c Mon Sep 17 00:00:00 2001
From: Carlos Rafael Giani <crg7475@mailbox.org>
Date: Sun, 20 Oct 2019 10:36:44 +0200
Subject: [PATCH] meson: Add valgrind feature

This allows for enabling/disabling Valgrind support. Since Valgrind is
an external dependency, such a feature is needed by build environemnts
such as Yocto to make sure builds are deterministic. These changes also
add more Valgrind specific configure log output.

Upstream-Status: Pending

Signed-off-by: Carlos Rafael Giani <crg7475@mailbox.org>
---
 meson.build       | 23 ++++++++++++++++++++++-
 meson_options.txt |  1 +
 2 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/meson.build b/meson.build
index b55ecc5..4751761 100644
--- a/meson.build
+++ b/meson.build
@@ -199,7 +199,6 @@ check_headers = [
   'sys/wait.h',
   'ucontext.h',
   'unistd.h',
-  'valgrind/valgrind.h',
   'sys/resource.h',
 ]
 
@@ -214,6 +213,28 @@ foreach h : check_headers
   endif
 endforeach
 
+valgrind_option = get_option('valgrind')
+if valgrind_option.disabled()
+  message('Valgrind support not requested; disabled.')
+else
+  valgrind_header = 'valgrind/valgrind.h'
+  has_valgrind_header = cc.has_header(valgrind_header)
+  if has_valgrind_header
+    message('Valgrind support requested, and header ' + valgrind_header + \
+        ' found. Enabled Valgrind support.')
+    define = 'HAVE_' + valgrind_header.underscorify().to_upper()
+    cdata.set(define, 1)
+  else
+    if valgrind_option.enabled()
+      error('Valgrind support requested and set as required, but header ' + \
+        valgrind_header + ' not found.')
+    else
+      message('Valgrind support requested, but header ' + valgrind_header + \
+        ' not found. Disabling Valgrind support.')
+    endif
+  endif
+endif
+
 if cc.has_member('struct tm', 'tm_gmtoff', prefix : '#include <time.h>')
   cdata.set('HAVE_TM_GMTOFF', 1)
 endif
diff --git a/meson_options.txt b/meson_options.txt
index e7ff7ba..8afde39 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -19,6 +19,7 @@ option('memory-alignment', type: 'combo',
 
 # Feature options
 option('check', type : 'feature', value : 'auto', description : 'Build unit test libraries')
+option('valgrind', type : 'feature', value : 'auto', description : 'Enable Valgrind support')
 option('libunwind', type : 'feature', value : 'auto', description : 'Use libunwind to generate backtraces')
 option('libdw', type : 'feature', value : 'auto', description : 'Use libdw to generate better backtraces from libunwind')
 option('dbghelp', type : 'feature', value : 'auto', description : 'Use dbghelp to generate backtraces')
-- 
2.17.1