From 572596127baa6108e4279cafd257e230698c61c1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Vladim=C3=ADr=20=C4=8Cun=C3=A1t?= Date: Mon, 5 Aug 2024 13:23:13 +0200 Subject: [PATCH] meson: make -Dmalloc=auto more clever --- meson.build | 8 +++++++- tests/meson.build | 1 - 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/meson.build b/meson.build index 0e91427a8..251991dda 100644 --- a/meson.build +++ b/meson.build @@ -137,9 +137,15 @@ systemd_files = get_option('systemd_files') systemd_legacy_units = get_option('systemd_legacy_units') libsystemd = dependency('libsystemd', required: systemd_files == 'enabled') +# Uh, lifted this trivial line from tests/meson.build due to dependency sorting: +build_extra_tests = get_option('extra_tests') == 'enabled' + ### Allocator # use empty name to disable the dependency, but still compile the dependent kresd -malloc_name = get_option('malloc') == 'disabled' ? '' : 'jemalloc' +malloc_name = '' +if get_option('malloc') == 'jemalloc' or (get_option('malloc') == 'auto' and not build_extra_tests) + malloc_name = 'jemalloc' +endif malloc = meson.get_compiler('c').find_library( malloc_name, required: get_option('malloc') == 'jemalloc', diff --git a/tests/meson.build b/tests/meson.build index 818169dfc..3b2bb6548 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -13,7 +13,6 @@ if get_option('unit_tests') != 'disabled' message('-------------------------------') endif -build_extra_tests = get_option('extra_tests') == 'enabled' build_config_tests = get_option('config_tests') == 'enabled' if get_option('config_tests') == 'auto' build_config_tests = build_extra_tests -- 2.47.2