tree-wide: check if necessary cflags dependencies are set

This makes each `foo_cflags` dependency define a `SYSTEMD_CFLAGS_MARKER_FOO`
macro, and checks if the macro is set when headers provided by external
libraries are included.

With this, we can fail fast at compile time if necessary `_cflags`
dependencies are omitted in meson.build. Missing dependencies found by this
mechanism have been added across the tree.
This commit is contained in:
Yu Watanabe
2026-07-03 21:50:45 +09:00
parent 4c5cbc970a
commit 5280cd7bdb
66 changed files with 476 additions and 69 deletions
+15
View File
@@ -6,25 +6,40 @@
#include <unistd.h>
#if HAVE_XZ
#ifndef SYSTEMD_CFLAGS_MARKER_LIBXZ
# error "missing libxz_cflags in meson dependency."
#endif
#include <lzma.h>
#endif
#if HAVE_LZ4
#ifndef SYSTEMD_CFLAGS_MARKER_LIBLZ4
# error "missing liblz4_cflags in meson dependency."
#endif
#include <lz4.h>
#include <lz4frame.h>
#include <lz4hc.h>
#endif
#if HAVE_ZSTD
#ifndef SYSTEMD_CFLAGS_MARKER_LIBZSTD
# error "missing libzstd_cflags in meson dependency."
#endif
#include <zstd.h>
#include <zstd_errors.h>
#endif
#if HAVE_ZLIB
#ifndef SYSTEMD_CFLAGS_MARKER_LIBZ
# error "missing libz_cflags in meson dependency."
#endif
#include <zlib.h>
#endif
#if HAVE_BZIP2
#ifndef SYSTEMD_CFLAGS_MARKER_LIBBZIP2
# error "missing libbzip2_cflags in meson dependency."
#endif
#include <bzlib.h>
#endif