Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame] | 1 | From 6d202833a5ae241eeb648631cf95090c452198f9 Mon Sep 17 00:00:00 2001 |
| 2 | From: Tanu Kaskinen <tanuk@iki.fi> |
| 3 | Date: Fri, 14 Feb 2020 07:29:33 +0200 |
| 4 | Subject: [PATCH] build-sys: Add an option for enabling/disabling Valgrind |
| 5 | |
| 6 | In OpenEmbedded the PulseAudio recipe currently disables Valgrind |
| 7 | support by passing "ac_cv_header_valgrind_memcheck_h=no" to the |
| 8 | configure script (this was added to make it deterministic whether |
| 9 | Valgrdind support gets enabled or not). I'm converting the PulseAudio |
| 10 | recipe to use Meson, and I needed an option to disable Valgrind. |
| 11 | |
| 12 | Upstream-Status: Backport |
| 13 | |
| 14 | Signed-off-by: Tanu Kaskinen <tanuk@iki.fi> |
| 15 | --- |
| 16 | meson.build | 6 +++++- |
| 17 | meson_options.txt | 3 +++ |
| 18 | 2 files changed, 8 insertions(+), 1 deletion(-) |
| 19 | |
| 20 | diff --git a/meson.build b/meson.build |
| 21 | index 658eeee57..258962724 100644 |
| 22 | --- a/meson.build |
| 23 | +++ b/meson.build |
| 24 | @@ -220,7 +220,6 @@ check_headers = [ |
| 25 | 'sys/un.h', |
| 26 | 'sys/wait.h', |
| 27 | 'syslog.h', |
| 28 | - 'valgrind/memcheck.h', |
| 29 | 'xlocale.h', |
| 30 | ] |
| 31 | |
| 32 | @@ -231,6 +230,10 @@ foreach h : check_headers |
| 33 | endif |
| 34 | endforeach |
| 35 | |
| 36 | +if cc.has_header('valgrind/memcheck.h', required: get_option('valgrind')) |
| 37 | + cdata.set('HAVE_VALGRIND_MEMCHECK_H', 1) |
| 38 | +endif |
| 39 | + |
| 40 | # FIXME: move this to the above set |
| 41 | if cc.has_header('pthread.h') |
| 42 | cdata.set('HAVE_PTHREAD', 1) |
| 43 | @@ -841,6 +844,7 @@ summary = [ |
| 44 | 'Enable SoXR (resampler): @0@'.format(soxr_dep.found()), |
| 45 | 'Enable WebRTC echo canceller: @0@'.format(webrtc_dep.found()), |
| 46 | 'Enable Gcov coverage: @0@'.format(get_option('gcov')), |
| 47 | + 'Enable Valgrind: @0@'.format(cdata.has('HAVE_VALGRIND_MEMCHECK_H')), |
| 48 | 'Enable man pages: @0@'.format(get_option('man')), |
| 49 | 'Enable unit tests: @0@'.format(get_option('tests')), |
| 50 | '', |
| 51 | diff --git a/meson_options.txt b/meson_options.txt |
| 52 | index 824f24e08..115cc84af 100644 |
| 53 | --- a/meson_options.txt |
| 54 | +++ b/meson_options.txt |
| 55 | @@ -138,6 +138,9 @@ option('systemd', |
| 56 | option('udev', |
| 57 | type : 'feature', value : 'auto', |
| 58 | description : 'Optional udev support') |
| 59 | +option('valgrind', |
| 60 | + type : 'feature', value : 'auto', |
| 61 | + description : 'Optional Valgrind support') |
| 62 | option('x11', |
| 63 | type : 'feature', value : 'auto', |
| 64 | description : 'Optional X11 support') |
| 65 | -- |
| 66 | 2.20.1 |
| 67 | |