HALF ECHO LEARN / REFERENCE COLLECTION
v262.2meson.build
Git blob: a4dfc11e43c6b0a295f78968c04686e85ecfc709
Lines 1001–2000 of 3,224
enable_debug_hashmap = false
enable_debug_mmap_cache = false
enable_debug_siphash = false
foreach name : get_option('debug-extra')
if name == 'hashmap'
enable_debug_hashmap = true
elif name == 'mmap-cache'
enable_debug_mmap_cache = true
elif name == 'siphash'
enable_debug_siphash = true
else
message(f'unknown debug option "@name@", ignoring')
endif
endforeach
conf.set10('ENABLE_DEBUG_HASHMAP', enable_debug_hashmap)
conf.set10('ENABLE_DEBUG_MMAP_CACHE', enable_debug_mmap_cache)
conf.set10('ENABLE_DEBUG_SIPHASH', enable_debug_siphash)
conf.set10('LOG_TRACE', get_option('log-trace'))
default_user_path = get_option('user-path')
if default_user_path != ''
conf.set_quoted('DEFAULT_USER_PATH', default_user_path)
endif
#####################################################################
libm = cc.find_library('m')
# On some architectures, libatomic is required. But on some installations,
# it is found, but actual linking fails. So let's try to use it opportunistically.
# If it is installed, but not needed, it will be dropped because of --as-needed.
basic_c_prog = '''int main(int argc, char **argv) { return 0; }'''
if cc.links(basic_c_prog, args : '-latomic', name : 'libatomic')
libatomic = declare_dependency(link_args : '-latomic')
else
libatomic = []
endif
if get_option('libc') == 'musl'
libcrypt = []
libcrypt_cflags = declare_dependency(
compile_args : '-DSYSTEMD_CFLAGS_MARKER_LIBCRYPT',
)
have = get_option('libcrypt').allowed()
else
libcrypt = dependency('libcrypt', 'libxcrypt',
required : get_option('libcrypt'),
version : '>=4.4.0')
libcrypt_cflags = declare_dependency(
dependencies : libcrypt.partial_dependency(includes: true, compile_args: true),
compile_args : '-DSYSTEMD_CFLAGS_MARKER_LIBCRYPT',
)
have = libcrypt.found()
endif
conf.set10('HAVE_LIBCRYPT', have)
# musl declares the ucontext.h functions but does not implement them; the fiber bootstrap in
# src/libsystemd/sd-future/fiber.c relies on them, so on musl we have to link to libucontext.
if get_option('libc') == 'musl'
libucontext = dependency('libucontext')
else
libucontext = []
endif
bpf_framework = get_option('bpf-framework')
bpf_compiler = get_option('bpf-compiler')
libbpf = dependency('libbpf',
required : bpf_framework,
version : bpf_compiler == 'gcc' ? '>= 1.4.0' : '>= 0.1.0')
libbpf_cflags = declare_dependency(
dependencies : libbpf.partial_dependency(includes: true, compile_args: true),
compile_args : '-DSYSTEMD_CFLAGS_MARKER_LIBBPF',
)
conf.set10('HAVE_LIBBPF', libbpf.found())
libmount = dependency('mount',
version : fuzzer_build ? '>= 0' : '>= 2.30',
required : get_option('libmount'))
have = libmount.found()
conf.set10('HAVE_LIBMOUNT', have)
libmount_cflags = declare_dependency(
dependencies : libmount.partial_dependency(includes: true, compile_args: true),
compile_args : '-DSYSTEMD_CFLAGS_MARKER_LIBMOUNT',
)
libfdisk = dependency('fdisk',
version : '>= 2.35',
required : get_option('fdisk'))
libfdisk_cflags = declare_dependency(
dependencies : libfdisk.partial_dependency(includes: true, compile_args: true),
compile_args : '-DSYSTEMD_CFLAGS_MARKER_LIBFDISK',
)
conf.set10('HAVE_LIBFDISK', libfdisk.found())
# This prefers pwquality if both are enabled or auto.
feature = get_option('pwquality').disable_auto_if(get_option('passwdqc').enabled())
libpwquality = dependency('pwquality',
version : '>= 1.4.1',
required : feature)
have = libpwquality.found()
if not have
# libpwquality is used for both features for simplicity
libpwquality = dependency('passwdqc',
required : get_option('passwdqc'))
endif
libpwquality_cflags = declare_dependency(
dependencies : libpwquality.partial_dependency(includes: true, compile_args: true),
compile_args : '-DSYSTEMD_CFLAGS_MARKER_LIBPWQUALITY',
)
conf.set10('HAVE_PWQUALITY', have)
conf.set10('HAVE_PASSWDQC', not have and libpwquality.found())
libseccomp = dependency('libseccomp',
version : '>= 2.4.0',
required : get_option('seccomp'))
conf.set10('HAVE_SECCOMP', libseccomp.found())
libseccomp_cflags = declare_dependency(
dependencies : libseccomp.partial_dependency(includes: true, compile_args: true),
compile_args : '-DSYSTEMD_CFLAGS_MARKER_LIBSECCOMP',
)
libselinux = dependency('libselinux',
version : '>= 2.1.9',
required : get_option('selinux'))
conf.set10('HAVE_SELINUX', libselinux.found())
libselinux_cflags = declare_dependency(
dependencies : libselinux.partial_dependency(includes: true, compile_args: true),
compile_args : '-DSYSTEMD_CFLAGS_MARKER_LIBSELINUX',
)
libapparmor = dependency('libapparmor',
version : '>= 2.13',
required : get_option('apparmor'))
conf.set10('HAVE_APPARMOR', libapparmor.found())
libapparmor_cflags = declare_dependency(
dependencies : libapparmor.partial_dependency(includes: true, compile_args: true),
compile_args : '-DSYSTEMD_CFLAGS_MARKER_LIBAPPARMOR',
)
have = get_option('smack') and get_option('smack-run-label') != ''
conf.set10('HAVE_SMACK_RUN_LABEL', have)
if have
conf.set_quoted('SMACK_RUN_LABEL', get_option('smack-run-label'))
endif
have = get_option('smack') and get_option('smack-default-process-label') != ''
if have
conf.set_quoted('SMACK_DEFAULT_PROCESS_LABEL', get_option('smack-default-process-label'))
endif
feature = get_option('polkit')
libpolkit = dependency('polkit-gobject-1',
required : feature.disabled() ? feature : false)
install_polkit = feature.allowed()
install_polkit_pkla = libpolkit.found() and libpolkit.version().version_compare('< 0.106')
if install_polkit_pkla
message('Old polkit detected, will install pkla files')
endif
conf.set10('ENABLE_POLKIT', install_polkit)
libacl = dependency('libacl',
required : get_option('acl'))
conf.set10('HAVE_ACL', libacl.found())
libacl_cflags = declare_dependency(
dependencies : libacl.partial_dependency(includes: true, compile_args: true),
compile_args : '-DSYSTEMD_CFLAGS_MARKER_LIBACL',
)
libaudit = dependency('audit',
required : get_option('audit'))
conf.set10('HAVE_AUDIT', libaudit.found())
libaudit_cflags = declare_dependency(
dependencies : libaudit.partial_dependency(includes: true, compile_args: true),
compile_args : '-DSYSTEMD_CFLAGS_MARKER_LIBAUDIT',
)
libblkid = dependency('blkid',
version : '>=2.37.0',
required : get_option('blkid'))
conf.set10('HAVE_BLKID', libblkid.found())
libblkid_cflags = declare_dependency(
dependencies : libblkid.partial_dependency(includes: true, compile_args: true),
compile_args : '-DSYSTEMD_CFLAGS_MARKER_LIBBLKID',
)
libkmod = dependency('libkmod',
version : '>= 15',
required : get_option('kmod'))
conf.set10('HAVE_KMOD', libkmod.found())
libkmod_cflags = declare_dependency(
dependencies : libkmod.partial_dependency(includes: true, compile_args: true),
compile_args : '-DSYSTEMD_CFLAGS_MARKER_LIBKMOD',
)
libxenctrl = dependency('xencontrol',
version : '>= 4.9',
required : get_option('xenctrl'))
conf.set10('HAVE_XENCTRL', libxenctrl.found())
libxenctrl_cflags = declare_dependency(
dependencies : libxenctrl.partial_dependency(includes: true, compile_args: true),
compile_args : '-DSYSTEMD_CFLAGS_MARKER_LIBXENCTRL',
)
feature = get_option('pam')
libpam = dependency('pam',
required : feature.disabled() ? feature : false)
if not libpam.found()
# Debian older than bookworm and Ubuntu older than 22.10 do not provide the .pc file.
libpam = cc.find_library('pam', required : feature)
endif
conf.set10('HAVE_PAM', libpam.found())
libpam_cflags = declare_dependency(
dependencies : libpam.partial_dependency(includes: true, compile_args: true),
compile_args : '-DSYSTEMD_CFLAGS_MARKER_LIBPAM',
)
libmicrohttpd = dependency('libmicrohttpd',
version : '>= 0.9.33',
required : get_option('microhttpd'))
conf.set10('HAVE_MICROHTTPD', libmicrohttpd.found())
libmicrohttpd_cflags = declare_dependency(
dependencies : libmicrohttpd.partial_dependency(includes: true, compile_args: true),
compile_args : '-DSYSTEMD_CFLAGS_MARKER_LIBMICROHTTPD',
)
libcryptsetup = get_option('libcryptsetup')
libcryptsetup_plugins = get_option('libcryptsetup-plugins')
if libcryptsetup_plugins.enabled()
if libcryptsetup.disabled()
error('libcryptsetup-plugins cannot be requested without libcryptsetup')
endif
libcryptsetup = libcryptsetup_plugins
endif
libcryptsetup = dependency('libcryptsetup',
version : '>= 2.4.0',
required : libcryptsetup)
libcryptsetup_cflags = declare_dependency(
dependencies : libcryptsetup.partial_dependency(includes: true, compile_args: true),
compile_args : '-DSYSTEMD_CFLAGS_MARKER_LIBCRYPTSETUP',
)
have = libcryptsetup.found()
conf.set10('HAVE_LIBCRYPTSETUP', have)
conf.set10('HAVE_LIBCRYPTSETUP_PLUGINS',
libcryptsetup_plugins.allowed() and have)
libcurl = dependency('libcurl',
version : '>= 7.32.0',
required : get_option('libcurl'))
libcurl_cflags = declare_dependency(
dependencies : libcurl.partial_dependency(includes: true, compile_args: true),
compile_args : '-DSYSTEMD_CFLAGS_MARKER_LIBCURL',
)
conf.set10('HAVE_LIBCURL', libcurl.found())
conf.set10('CURL_NO_OLDIES', conf.get('BUILD_MODE_DEVELOPER') == 1)
libidn2 = dependency('libidn2',
required : get_option('libidn2'))
libidn2_cflags = declare_dependency(
dependencies : libidn2.partial_dependency(includes: true, compile_args: true),
compile_args : '-DSYSTEMD_CFLAGS_MARKER_LIBIDN2',
)
conf.set10('HAVE_LIBIDN2', libidn2.found())
libqrencode = dependency('libqrencode',
version : '>= 3',
required : get_option('qrencode'))
libqrencode_cflags = declare_dependency(
dependencies : libqrencode.partial_dependency(includes: true, compile_args: true),
compile_args : '-DSYSTEMD_CFLAGS_MARKER_LIBQRENCODE',
)
conf.set10('HAVE_QRENCODE', libqrencode.found())
feature = get_option('gcrypt')
libgcrypt = dependency('libgcrypt',
required : feature.disabled() ? feature : false)
conf.set10('HAVE_GCRYPT', libgcrypt.found())
if libgcrypt.found()
libgcrypt_cflags = declare_dependency(
dependencies : libgcrypt.partial_dependency(includes: true, compile_args: true),
compile_args : '-DSYSTEMD_CFLAGS_MARKER_LIBGCRYPT',
)
else
libgcrypt_cflags = []
endif
libgnutls = dependency('gnutls',
version : '>= 3.1.4',
required : get_option('gnutls'))
conf.set10('HAVE_GNUTLS', libgnutls.found())
libgnutls_cflags = declare_dependency(
dependencies : libgnutls.partial_dependency(includes: true, compile_args: true),
compile_args : '-DSYSTEMD_CFLAGS_MARKER_LIBGNUTLS',
)
libopenssl = dependency('openssl',
version : '>= 3.0.0',
required : get_option('openssl'))
libopenssl_cflags = declare_dependency(
dependencies : libopenssl.partial_dependency(includes: true, compile_args: true),
compile_args : '-DSYSTEMD_CFLAGS_MARKER_LIBOPENSSL',
)
conf.set10('HAVE_OPENSSL', libopenssl.found())
libp11kit = dependency('p11-kit-1',
version : '>= 0.23.3',
required : get_option('p11kit'))
conf.set10('HAVE_P11KIT', libp11kit.found())
libp11kit_cflags = declare_dependency(
dependencies : libp11kit.partial_dependency(includes: true, compile_args: true),
compile_args : '-DSYSTEMD_CFLAGS_MARKER_LIBP11KIT',
)
feature = get_option('libfido2').require(
conf.get('HAVE_OPENSSL') == 1,
error_message : 'openssl required')
libfido2 = dependency('libfido2',
required : feature)
libfido2_cflags = declare_dependency(
dependencies : libfido2.partial_dependency(includes: true, compile_args: true),
compile_args : '-DSYSTEMD_CFLAGS_MARKER_LIBFIDO2',
)
conf.set10('HAVE_LIBFIDO2', libfido2.found())
tss2_esys = dependency('tss2-esys', required : get_option('tpm2'))
tss2_mu = dependency('tss2-mu', required : get_option('tpm2'))
tss2_rc = dependency('tss2-rc', required : get_option('tpm2'))
tss2_tcti_device = dependency('tss2-tcti-device', required : get_option('tpm2'))
tpm2_cflags = declare_dependency(
dependencies : [
tss2_esys.partial_dependency(includes: true, compile_args: true),
tss2_mu.partial_dependency(includes: true, compile_args: true),
tss2_rc.partial_dependency(includes: true, compile_args: true),
tss2_tcti_device.partial_dependency(includes: true, compile_args: true),
],
compile_args : '-DSYSTEMD_CFLAGS_MARKER_TPM2',
)
conf.set10('HAVE_TPM2', tss2_esys.found() and tss2_mu.found() and tss2_rc.found() and tss2_tcti_device.found())
conf.set10('HAVE_TSS2_ESYS3', tss2_esys.found() and tss2_esys.version().version_compare('>= 3.0.0'))
conf.set('TPM2_NVPCR_BASE', get_option('tpm2-nvpcr-base'))
libdw = dependency('libdw',
version : '>=0.177',
required : get_option('elfutils'))
libelf = dependency('libelf',
required : get_option('elfutils'))
libelf_cflags = declare_dependency(
dependencies : [
libelf.partial_dependency(includes: true, compile_args: true),
libdw.partial_dependency(includes: true, compile_args: true),
],
compile_args : '-DSYSTEMD_CFLAGS_MARKER_LIBELF',
)
conf.set10('HAVE_ELFUTILS', libdw.found() and libelf.found())
libz = dependency('zlib',
required : get_option('zlib'))
conf.set10('HAVE_ZLIB', libz.found())
libz_cflags = declare_dependency(
dependencies : libz.partial_dependency(includes: true, compile_args: true),
compile_args : '-DSYSTEMD_CFLAGS_MARKER_LIBZ',
)
feature = get_option('bzip2')
libbzip2 = dependency('bzip2',
required : feature.disabled() ? feature : false)
if not libbzip2.found()
# Debian and Ubuntu do not provide the .pc file.
libbzip2 = cc.find_library('bz2', required : feature)
endif
conf.set10('HAVE_BZIP2', libbzip2.found())
libbzip2_cflags = declare_dependency(
dependencies : libbzip2.partial_dependency(includes: true, compile_args: true),
compile_args : '-DSYSTEMD_CFLAGS_MARKER_LIBBZIP2',
)
libxz = dependency('liblzma',
required : get_option('xz'))
conf.set10('HAVE_XZ', libxz.found())
libxz_cflags = declare_dependency(
dependencies : libxz.partial_dependency(includes: true, compile_args: true),
compile_args : '-DSYSTEMD_CFLAGS_MARKER_LIBXZ',
)
liblz4 = dependency('liblz4',
version : '>= 1.3.0',
required : get_option('lz4'))
conf.set10('HAVE_LZ4', liblz4.found())
liblz4_cflags = declare_dependency(
dependencies : liblz4.partial_dependency(includes: true, compile_args: true),
compile_args : '-DSYSTEMD_CFLAGS_MARKER_LIBLZ4',
)
libzstd = dependency('libzstd',
version : '>= 1.4.0',
required : get_option('zstd'))
conf.set10('HAVE_ZSTD', libzstd.found())
libzstd_cflags = declare_dependency(
dependencies : libzstd.partial_dependency(includes: true, compile_args: true),
compile_args : '-DSYSTEMD_CFLAGS_MARKER_LIBZSTD',
)
conf.set10('HAVE_COMPRESSION', libxz.found() or liblz4.found() or libzstd.found())
compression = get_option('default-compression')
if compression == 'auto'
if libzstd.found()
compression = 'zstd'
elif liblz4.found()
compression = 'lz4'
elif libxz.found()
compression = 'xz'
else
compression = 'none'
endif
elif compression == 'zstd' and not libzstd.found()
error('default-compression=zstd requires zstd')
elif compression == 'lz4' and not liblz4.found()
error('default-compression=lz4 requires lz4')
elif compression == 'xz' and not libxz.found()
error('default-compression=xz requires xz')
endif
# In the dlopen ELF note we save the default compression library with a
# higher priority, so that packages can give it priority over the
# secondary libraries.
conf.set('COMPRESSION_PRIORITY_ZSTD',
compression == 'zstd' ? 'recommended' : 'suggested')
conf.set('COMPRESSION_PRIORITY_LZ4',
compression == 'lz4' ? 'recommended' : 'suggested')
conf.set('COMPRESSION_PRIORITY_XZ',
compression == 'xz' ? 'recommended' : 'suggested')
conf.set('DEFAULT_COMPRESSION', 'COMPRESSION_@0@'.format(compression.to_upper()))
libarchive = dependency('libarchive',
version : '>= 3.0',
required : get_option('libarchive'))
libarchive_cflags = declare_dependency(
dependencies : libarchive.partial_dependency(includes: true, compile_args: true),
compile_args : '-DSYSTEMD_CFLAGS_MARKER_LIBARCHIVE',
)
conf.set10('HAVE_LIBARCHIVE', libarchive.found())
libxkbcommon = dependency('xkbcommon',
version : '>= 0.3.0',
required : get_option('xkbcommon'))
libxkbcommon_cflags = declare_dependency(
dependencies : libxkbcommon.partial_dependency(includes: true, compile_args: true),
compile_args : '-DSYSTEMD_CFLAGS_MARKER_LIBXKBCOMMON',
)
conf.set10('HAVE_XKBCOMMON', libxkbcommon.found())
libpcre2 = dependency('libpcre2-8',
required : get_option('pcre2'))
libpcre2_cflags = declare_dependency(
dependencies : libpcre2.partial_dependency(includes: true, compile_args: true),
compile_args : '-DSYSTEMD_CFLAGS_MARKER_LIBPCRE2',
)
conf.set10('HAVE_PCRE2', libpcre2.found())
libglib = dependency('glib-2.0',
version : '>= 2.22.0',
required : get_option('glib'))
libgobject = dependency('gobject-2.0',
version : '>= 2.22.0',
required : get_option('glib'))
libgio = dependency('gio-2.0',
required : get_option('glib'))
conf.set10('HAVE_GLIB', libglib.found() and libgobject.found() and libgio.found())
libglib_cflags = declare_dependency(
dependencies : [
libglib.partial_dependency(includes: true, compile_args: true),
libgobject.partial_dependency(includes: true, compile_args: true),
libgio.partial_dependency(includes: true, compile_args: true),
],
compile_args : '-DSYSTEMD_CFLAGS_MARKER_LIBGLIB',
)
libdbus = dependency('dbus-1',
version : '>= 1.3.2',
required : get_option('dbus'))
conf.set10('HAVE_DBUS', libdbus.found())
libdbus_cflags = declare_dependency(
dependencies : libdbus.partial_dependency(includes: true, compile_args: true),
compile_args : '-DSYSTEMD_CFLAGS_MARKER_LIBDBUS',
)
dbusdatadir = libdbus.get_variable(pkgconfig: 'datadir', default_value: datadir) / 'dbus-1'
dbuspolicydir = get_option('dbuspolicydir')
if dbuspolicydir == ''
dbuspolicydir = dbusdatadir / 'system.d'
endif
dbussessionservicedir = get_option('dbussessionservicedir')
if dbussessionservicedir == ''
dbussessionservicedir = libdbus.get_variable(pkgconfig: 'session_bus_services_dir', default_value: dbusdatadir / 'services')
endif
dbussystemservicedir = get_option('dbussystemservicedir')
if dbussystemservicedir == ''
dbussystemservicedir = libdbus.get_variable(pkgconfig: 'system_bus_services_dir', default_value: dbusdatadir / 'system-services')
endif
dbus_interfaces_dir = get_option('dbus-interfaces-dir')
if dbus_interfaces_dir == '' or dbus_interfaces_dir == 'yes'
if meson.is_cross_build() and dbus_interfaces_dir != 'yes'
dbus_interfaces_dir = 'no'
warning('Exporting D-Bus interface XML files is disabled during cross build. Pass path or "yes" to force enable.')
else
dbus_interfaces_dir = libdbus.get_variable(pkgconfig: 'interfaces_dir', default_value: dbusdatadir / 'interfaces')
endif
endif
dmi_arches = ['x86', 'x86_64', 'aarch64', 'arm', 'ia64', 'loongarch64', 'mips', 'riscv64']
conf.set10('HAVE_DMI', host_machine.cpu_family() in dmi_arches)
dns_over_tls = get_option('dns-over-tls')
have_openssl = conf.get('HAVE_OPENSSL') == 1
if dns_over_tls == 'false'
have = false
elif dns_over_tls == 'auto'
have = have_openssl
elif have_openssl
have = true
else
error('DNS-over-TLS support was requested, but OpenSSL support is disabled.')
endif
conf.set10('ENABLE_DNS_OVER_TLS', have)
default_dns_over_tls = get_option('default-dns-over-tls')
if default_dns_over_tls != 'no' and conf.get('ENABLE_DNS_OVER_TLS') == 0
message('default-dns-over-tls cannot be enabled or set to opportunistic when DNS-over-TLS support is disabled. Setting default-dns-over-tls to no.')
default_dns_over_tls = 'no'
endif
conf.set('DEFAULT_DNS_OVER_TLS_MODE',
'DNS_OVER_TLS_' + default_dns_over_tls.underscorify().to_upper())
conf.set_quoted('DEFAULT_DNS_OVER_TLS_MODE_STR', default_dns_over_tls)
default_mdns = get_option('default-mdns')
conf.set('DEFAULT_MDNS_MODE',
'RESOLVE_SUPPORT_' + default_mdns.to_upper())
conf.set_quoted('DEFAULT_MDNS_MODE_STR', default_mdns)
default_llmnr = get_option('default-llmnr')
conf.set('DEFAULT_LLMNR_MODE',
'RESOLVE_SUPPORT_' + default_llmnr.to_upper())
conf.set_quoted('DEFAULT_LLMNR_MODE_STR', default_llmnr)
have = get_option('repart').require(
conf.get('HAVE_LIBFDISK') == 1,
error_message : 'fdisk required').allowed()
conf.set10('ENABLE_REPART', have)
default_dnssec = get_option('default-dnssec')
if default_dnssec != 'no' and conf.get('HAVE_OPENSSL') == 0
message('default-dnssec cannot be set to yes or allow-downgrade when openssl is disabled. Setting default-dnssec to no.')
default_dnssec = 'no'
endif
conf.set('DEFAULT_DNSSEC_MODE',
'DNSSEC_' + default_dnssec.underscorify().to_upper())
conf.set_quoted('DEFAULT_DNSSEC_MODE_STR', default_dnssec)
have = get_option('imds').require(
conf.get('HAVE_LIBCURL') == 1,
error_message : 'curl required').allowed()
conf.set10('ENABLE_IMDS', have)
conf.set('IMDS_NETWORK_DEFAULT', 'IMDS_NETWORK_@0@'.format(get_option('imds-network')).to_upper())
have = get_option('importd').require(
conf.get('HAVE_LIBCURL') == 1 and
conf.get('HAVE_OPENSSL') == 1 and
conf.get('HAVE_ZLIB') == 1 and
conf.get('HAVE_XZ') == 1,
error_message : 'curl, openssl, zlib and xz required').allowed()
conf.set10('ENABLE_IMPORTD', have)
have = get_option('sysupdate').require(
conf.get('ENABLE_IMPORTD') == 1 and
conf.get('HAVE_OPENSSL') == 1 and
conf.get('HAVE_LIBFDISK') == 1,
error_message : 'systemd-importd, fdisk, and openssl required').allowed()
conf.set10('ENABLE_SYSUPDATE', have)
have2 = get_option('sysupdated')
if have2 == 'enabled'
if have
have2 = true
else
error('sysupdated requires sysupdate to be enabled')
endif
elif have2 == 'auto'
have2 = have and conf.get('BUILD_MODE_DEVELOPER') == 1
else
have2 = false
endif
conf.set10('ENABLE_SYSUPDATED', have2)
conf.set10('ENABLE_STORAGETM', get_option('storagetm'))
have = get_option('homed').require(
conf.get('HAVE_LIBCRYPT') == 1 and
conf.get('HAVE_OPENSSL') == 1 and
conf.get('HAVE_LIBFDISK') == 1 and
conf.get('HAVE_LIBCRYPTSETUP') == 1,
error_message : 'libcrypt, openssl, fdisk, and libcryptsetup required').allowed()
conf.set10('ENABLE_HOMED', have)
have = have and conf.get('HAVE_PAM') == 1
conf.set10('ENABLE_PAM_HOME', have)
feature = get_option('remote')
if feature.enabled()
if conf.get('HAVE_MICROHTTPD') != 1
error('remote support was requested, but microhttpd is not available')
endif
if conf.get('HAVE_LIBCURL') != 1
error('remote support was requested, but libcurl is not available')
endif
endif
# A more minimal version of systemd-journal-remote can always be built, even if neither
# libcurl nor microhttpd are available.
conf.set10('ENABLE_REMOTE', feature.allowed())
feature = get_option('vmspawn').disable_auto_if(conf.get('BUILD_MODE_DEVELOPER') == 0)
conf.set10('ENABLE_VMSPAWN', feature.allowed())
feature = get_option('nspawn')
conf.set10('ENABLE_NSPAWN', feature.allowed())
conf.set10('DEFAULT_MOUNTFSD_TRUSTED_DIRECTORIES', get_option('default-mountfsd-trusted-directories'))
foreach tuple : [
['analyze'],
['backlight'],
['binfmt'],
['compat-mutable-uid-boundaries'],
['compat-sysv-interfaces'],
['coredump'],
['efi'],
['environment-d'],
['firstboot'],
['gshadow', get_option('libc') != 'musl', 'musl does not support it'],
['hibernate'],
['hostnamed'],
['hwdb'],
['idn', conf.get('HAVE_NI_IDN') == 1, 'NI_IDN is not defined'],
['ima'],
['ipe'],
['initrd'],
['kernel-install'],
['ldconfig'],
['localed'],
['logind'],
['machined'],
['mountfsd'],
['networkd'],
['nsresourced'],
['nss-myhostname', get_option('libc') != 'musl', 'musl does not support it'],
['nss-systemd', get_option('libc') != 'musl', 'musl does not support it'],
['oomd'],
['portabled'],
['pstore'],
['quotacheck'],
['randomseed'],
['resolve'],
['rfkill'],
['smack'],
['sysext'],
['sysinstall'],
['sysusers'],
['timedated'],
['timesyncd'],
['tmpfiles'],
['tpm'],
['utmp', get_option('libc') != 'musl', 'musl does not support it'],
['userdb'],
['vconsole'],
['xdg-autostart'],
]
have = get_option(tuple[0])
if have and tuple.length() >= 3 and not tuple[1]
warning('@0@ support is requested but @1@, disabling it'.format(tuple[0], tuple[2]))
have = false
endif
name = 'ENABLE_' + tuple[0].underscorify().to_upper()
conf.set10(name, have)
endforeach
enable_sysusers = conf.get('ENABLE_SYSUSERS') == 1
foreach tuple : [['nss-mymachines', 'machined'],
['nss-resolve', 'resolve']]
want = get_option(tuple[0])
if want.enabled()
if get_option('libc') == 'musl'
error('@0@ is requested but musl does not support it'.format(tuple[0]))
endif
if not get_option(tuple[1])
error('@0@ is requested but @1@ is disabled'.format(tuple[0], tuple[1]))
endif
have = true
elif want.allowed()
have = get_option(tuple[1]) and get_option('libc') != 'musl'
else
have = false
endif
name = 'ENABLE_' + tuple[0].underscorify().to_upper()
conf.set10(name, have)
endforeach
enable_nss = false
foreach term : ['ENABLE_NSS_MYHOSTNAME',
'ENABLE_NSS_MYMACHINES',
'ENABLE_NSS_RESOLVE',
'ENABLE_NSS_SYSTEMD']
if conf.get(term) == 1
enable_nss = true
endif
endforeach
conf.set10('ENABLE_NSS', enable_nss)
conf.set10('ENABLE_TIMEDATECTL', get_option('timedated') or get_option('timesyncd'))
conf.set10('ENABLE_SSH_PROXY_CONFIG', sshconfdir != 'no')
conf.set10('ENABLE_SSH_USERDB_CONFIG', conf.get('ENABLE_USERDB') == 1 and sshdconfdir != 'no')
conf.set10('SYSTEMD_SLOW_TESTS_DEFAULT', want_slow_tests)
#####################################################################
pymod = import('python')
python = pymod.find_installation('python3', required : true, modules : ['jinja2'])
if not python.language_version().version_compare('>=3.9')
error('Python >= 3.9 is required')
endif
#####################################################################
efi_arch = {
'aarch64' : 'aa64',
'arm' : 'arm',
'loongarch32' : 'loongarch32',
'loongarch64' : 'loongarch64',
'riscv32' : 'riscv32',
'riscv64' : 'riscv64',
'x86_64' : 'x64',
'x86' : 'ia32',
}.get(host_machine.cpu_family(), '')
pyelftools = pymod.find_installation(
'python3',
required : get_option('bootloader').enabled() or want_dlopen_tests,
modules : ['elftools'],
)
have = get_option('bootloader').require(
pyelftools.found() and get_option('efi') and efi_arch != '',
error_message : 'unsupported EFI arch or EFI support is disabled').allowed()
conf.set10('ENABLE_BOOTLOADER', have)
conf.set_quoted('EFI_MACHINE_TYPE_NAME', efi_arch)
efi_arch_alt = ''
efi_cpu_family_alt = ''
if have and efi_arch == 'x64' and cc.links('''
#include <limits.h>
int main(int argc, char *argv[]) {
return __builtin_popcount(argc - CHAR_MAX);
}''', args : ['-m32', '-march=i686'], name : '32bit build possible')
efi_arch_alt = 'ia32'
efi_cpu_family_alt = 'x86'
endif
want_ukify = get_option('ukify').allowed()
conf.set10('ENABLE_UKIFY', want_ukify)
#####################################################################
version_tag = get_option('version-tag')
if version_tag == ''
version_tag = meson.project_version()
endif
conf.set_quoted('VERSION_TAG', version_tag)
generated_sources = []
subdir('tools')
subdir('src/version')
subdir('src/bpf')
shared_lib_tag = get_option('shared-lib-tag')
if shared_lib_tag == ''
shared_lib_tag = project_major_version
endif
#####################################################################
subdir('src/coverage')
#####################################################################
config_h = configure_file(
output : 'config.h',
configuration : conf)
userspace_c_args += ['-include', 'config.h']
jinja2_cmdline = [meson_render_jinja2_py, config_h]
userspace = declare_dependency(
compile_args : userspace_c_args,
link_args : userspace_c_ld_args,
sources : userspace_sources,
)
man_page_depends = []
#####################################################################
simple_tests = []
libsystemd_tests = []
simple_fuzzers = []
catalogs = []
modules = [] # nss, pam, and other plugins
executables = []
executables_by_name = {}
exported_by_name = {}
fuzzer_exes = []
sources = []
# binaries that have --help and are intended for use by humans,
# usually, but not always, installed in /usr/bin.
public_programs = []
# D-Bus introspection XML export
dbus_programs = []
# A list of boot stubs. Required for testing of ukify.
boot_stubs = []
# This is similar to system_includes below, but for passing custom_target().
system_include_args = [
'-isystem', meson.project_build_root() / 'src/include/override',
'-isystem', meson.project_source_root() / 'src/include/override',
'-isystem', meson.project_build_root() / 'src/include/uapi',
'-isystem', meson.project_source_root() / 'src/include/uapi',
]
system_includes = [
include_directories(
# gcc(1) says
# "Directories specified with -isystem options are scanned in left-to-right order",
# and meson puts the directories in the reversed order. Hence, a directory with a lower
# priority must be listed earlier.
'src/include/uapi',
'src/include/override',
is_system : true,
),
]
libc_include_dir = 'src/include' / get_option('libc')
system_include_args = [
'-isystem', meson.project_build_root() / libc_include_dir,
'-isystem', meson.project_source_root() / libc_include_dir,
] + system_include_args
system_includes += include_directories(libc_include_dir, is_system : true)
basic_includes = [
include_directories(
'src/basic',
'src/fundamental',
'src/systemd',
),
system_includes,
version_include,
]
libsystemd_includes = [include_directories(
'src/libsystemd',
'src/libsystemd/sd-bus',
'src/libsystemd/sd-device',
'src/libsystemd/sd-event',
'src/libsystemd/sd-future',
'src/libsystemd/sd-hwdb',
'src/libsystemd/sd-id128',
'src/libsystemd/sd-journal',
'src/libsystemd/sd-json',
'src/libsystemd/sd-netlink',
'src/libsystemd/sd-network',
'src/libsystemd/sd-path',
'src/libsystemd/sd-resolve',
'src/libsystemd/sd-varlink'), basic_includes]
includes = [
include_directories(
'src/shared',
'src/bpf',
),
libsystemd_includes,
]
subdir('po')
subdir('catalog')
subdir('src/include')
subdir('src/libc')
subdir('src/fundamental')
subdir('src/basic')
subdir('src/libsystemd')
subdir('src/shared')
subdir('src/libudev')
libsystemd = shared_library(
'systemd',
version : libsystemd_version,
include_directories : libsystemd_includes,
implicit_include_directories : false,
link_args : ['-shared',
# Make sure our library is never deleted from memory, so that our open logging fds don't leak on dlopen/dlclose cycles.
'-z', 'nodelete',
'-Wl,--version-script=' + libsystemd_sym_path],
link_with : [libc_wrapper_static,
libbasic_static],
link_whole : [libsystemd_static],
dependencies : [libucontext, userspace],
link_depends : libsystemd_sym,
install : true,
install_tag: 'libsystemd',
install_dir : libdir)
if static_libsystemd != 'false'
install_libsystemd_static = static_library(
'systemd',
libc_wrapper_sources,
libsystemd_sources,
basic_sources,
fundamental_sources,
include_directories : libsystemd_includes,
implicit_include_directories : false,
install : true,
install_tag: 'libsystemd',
install_dir : libdir,
pic : static_libsystemd_pic,
dependencies : [
libbzip2_cflags,
liblz4_cflags,
libm,
libucontext,
libxz_cflags,
libz_cflags,
libzstd_cflags,
userspace,
],
c_args : libsystemd_c_args + (static_libsystemd_pic ? [] : ['-fno-PIC']))
alias_target('libsystemd', libsystemd, install_libsystemd_static)
else
alias_target('libsystemd', libsystemd)
endif
libudev = shared_library(
'udev',
version : libudev_version,
include_directories : includes,
implicit_include_directories : false,
link_args : ['-shared',
'-Wl,--version-script=' + libudev_sym_path],
link_with : [libsystemd_static],
link_whole : libudev_basic,
dependencies : [userspace],
link_depends : libudev_sym,
install : true,
install_tag: 'libudev',
install_dir : libdir)
if static_libudev != 'false'
install_libudev_static = static_library(
'udev',
libc_wrapper_sources,
basic_sources,
fundamental_sources,
shared_sources,
libsystemd_sources,
libudev_sources,
include_directories : includes,
implicit_include_directories : false,
install : true,
install_tag: 'libudev',
install_dir : libdir,
link_depends : libudev_sym,
dependencies : [
libbzip2_cflags,
liblz4_cflags,
libshared_deps,
libxz_cflags,
libz_cflags,
libzstd_cflags,