From 5d1678974a20b70dff6145901ba95e11ee25cece Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Thu, 25 Jun 2020 15:27:37 +0100 Subject: [PATCH] build: Simplify config file setup This introduces no functional changes, just simplifies the code. As described in the meson manual (https://mesonbuild.com/Configuration.html#configuring-without-an-input-file), passing `false` to `configuration_data.set()` will cause the specified value to be `#undef`fed. Passing `true` will cause it to be defined to 1. Signed-off-by: Philip Withnall --- meson.build | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/meson.build b/meson.build index 57cffa7e..92c49ee5 100644 --- a/meson.build +++ b/meson.build @@ -62,21 +62,14 @@ config_h.set_quoted('GETTEXT_PACKAGE', 'sysprof') config_h.set10('ENABLE_NLS', true) config_h.set_quoted('PACKAGE_LOCALE_DIR', join_paths(get_option('prefix'), get_option('datadir'), 'locale')) config_h.set('LOCALEDIR', 'PACKAGE_LOCALE_DIR') - -if cc.has_header('execinfo.h') - config_h.set10('HAVE_EXECINFO_H', true) -endif +config_h.set('HAVE_EXECINFO_H', cc.has_header('execinfo.h')) config_h.set('HAVE_STRLCPY', cc.has_function('strlcpy')) if get_option('libunwind') libunwind_dep = dependency('libunwind-generic', required: false) - if libunwind_dep.found() - config_h.set10('ENABLE_LIBUNWIND', libunwind_dep.found()) - if cc.has_header_symbol('libunwind.h', 'unw_set_cache_size', dependencies: [libunwind_dep]) - config_h.set10('HAVE_UNW_SET_CACHE_SIZE', 1) - endif - endif + config_h.set('ENABLE_LIBUNWIND', libunwind_dep.found()) + config_h.set('HAVE_UNW_SET_CACHE_SIZE', libunwind_dep.found() and cc.has_header_symbol('libunwind.h', 'unw_set_cache_size', dependencies: [libunwind_dep])) endif # Development build setup @@ -84,9 +77,7 @@ config_h.set('DEVELOPMENT_BUILD', version_split[1].to_int().is_odd()) has_use_clockid = cc.has_member('struct perf_event_attr', 'use_clockid', prefix: '#include ') has_clockid = cc.has_member('struct perf_event_attr', 'clockid', prefix: '#include ') -if has_use_clockid and has_clockid - config_h.set10('HAVE_PERF_CLOCKID', true) -endif +config_h.set('HAVE_PERF_CLOCKID', has_use_clockid and has_clockid) add_project_arguments([ '-I' + meson.build_root(), # config.h