build: Compile fuzz-journald-util.c only if want_fuzz_tests

fuzz-journald-util.c is compiled unconditionally even though fuzzing
tests aren't enabled. Only build it if fuzzing tests are configured.
This also ensure that the functions it uses from src/shared/tests.c are
available.

Fixes 32bd43d768
Closes #39984

Signed-off-by: Chris Hofer <christian.hofer@codasip.com>
This commit is contained in:
Chris Hofer
2026-04-22 16:29:18 +02:00
committed by Zbigniew Jędrzejewski-Szmek
parent b5f219d834
commit 85b5acde86
+8 -3
View File
@@ -19,11 +19,16 @@ systemd_journald_extract_sources = files(
'journald-syslog.c',
'journald-varlink.c',
'journald-wall.c',
# Build fuzz-journald.c as part of systemd-journald so we only compile it once instead of once per
# fuzz test.
'fuzz-journald-util.c',
)
if want_fuzz_tests
# Build fuzz-journald-util.c as part of systemd-journald so we only
# compile it once instead of once per fuzz test.
systemd_journald_extract_sources += files(
'fuzz-journald-util.c',
)
endif
journald_gperf_c = custom_target(
input : 'journald-gperf.gperf',
output : 'journald-gperf.c',