From 349cc4a507c4d84fcadf61f42159ea6412717896 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Tue, 3 Oct 2017 10:41:51 +0200 Subject: [PATCH] build-sys: use #if Y instead of #ifdef Y everywhere The advantage is that is the name is mispellt, cpp will warn us. $ git grep -Ee "conf.set\('(HAVE|ENABLE)_" -l|xargs sed -r -i "s/conf.set\('(HAVE|ENABLE)_/conf.set10('\1_/" $ git grep -Ee '#ifn?def (HAVE|ENABLE)' -l|xargs sed -r -i 's/#ifdef (HAVE|ENABLE)/#if \1/; s/#ifndef (HAVE|ENABLE)/#if ! \1/;' $ git grep -Ee 'if.*defined\(HAVE' -l|xargs sed -i -r 's/defined\((HAVE_[A-Z0-9_]*)\)/\1/g' $ git grep -Ee 'if.*defined\(ENABLE' -l|xargs sed -i -r 's/defined\((ENABLE_[A-Z0-9_]*)\)/\1/g' + manual changes to meson.build squash! build-sys: use #if Y instead of #ifdef Y everywhere v2: - fix incorrect setting of HAVE_LIBIDN2 --- docs/sysvinit/meson.build | 2 +- docs/var-log/meson.build | 2 +- hwdb/meson.build | 2 +- man/meson.build | 2 +- meson.build | 303 +++++++++++--------- network/meson.build | 2 +- shell-completion/bash/meson.build | 2 +- shell-completion/zsh/meson.build | 2 +- src/analyze/analyze.c | 4 +- src/basic/blkid-util.h | 4 +- src/basic/btrfs-util.c | 2 +- src/basic/build.h | 40 +-- src/basic/def.h | 4 +- src/basic/hashmap.c | 22 +- src/basic/hashmap.h | 4 +- src/basic/memfd-util.c | 2 +- src/basic/missing.h | 22 +- src/basic/path-util.h | 2 +- src/basic/process-util.c | 4 +- src/basic/random-util.c | 8 +- src/basic/selinux-util.c | 34 +-- src/basic/smack-util.c | 2 +- src/basic/socket-util.c | 2 +- src/boot/efi/boot.c | 2 +- src/boot/efi/measure.c | 2 +- src/boot/efi/meson.build | 4 +- src/boot/efi/stub.c | 2 +- src/core/audit-fd.c | 2 +- src/core/dbus-execute.c | 14 +- src/core/dbus.c | 4 +- src/core/execute.c | 48 ++-- src/core/ima-setup.c | 2 +- src/core/kmod-setup.c | 8 +- src/core/load-fragment.c | 16 +- src/core/main.c | 14 +- src/core/manager.c | 6 +- src/core/mount-setup.c | 12 +- src/core/namespace.c | 2 +- src/core/selinux-access.c | 6 +- src/core/selinux-access.h | 2 +- src/core/selinux-setup.c | 6 +- src/core/smack-setup.c | 4 +- src/core/umount.c | 2 +- src/coredump/coredump.c | 8 +- src/coredump/coredumpctl.c | 2 +- src/coredump/meson.build | 2 +- src/delta/delta.c | 4 +- src/fsck/fsck.c | 4 +- src/gpt-auto-generator/gpt-auto-generator.c | 6 +- src/hostname/meson.build | 2 +- src/import/meson.build | 2 +- src/journal-remote/journal-gatewayd.c | 2 +- src/journal-remote/journal-remote.c | 4 +- src/journal-remote/meson.build | 4 +- src/journal-remote/microhttpd-util.c | 4 +- src/journal/audit-type.c | 2 +- src/journal/compress.c | 26 +- src/journal/compress.h | 4 +- src/journal/journal-def.h | 8 +- src/journal/journal-file.c | 36 +-- src/journal/journal-file.h | 6 +- src/journal/journal-verify.c | 6 +- src/journal/journalctl.c | 14 +- src/journal/journald-context.c | 4 +- src/journal/journald-native.c | 2 +- src/journal/journald-server.c | 8 +- src/journal/journald-stream.c | 2 +- src/journal/journald-syslog.c | 2 +- src/journal/journald.c | 2 +- src/journal/meson.build | 6 +- src/journal/mmap-cache.c | 4 +- src/journal/sd-journal.c | 4 +- src/journal/test-compress-benchmark.c | 8 +- src/journal/test-compress.c | 16 +- src/journal/test-journal.c | 2 +- src/libsystemd/sd-bus/bus-control.c | 2 +- src/libsystemd/sd-bus/bus-kernel.c | 2 +- src/libsystemd/sd-bus/test-bus-gvariant.c | 6 +- src/libsystemd/sd-bus/test-bus-marshal.c | 8 +- src/libsystemd/sd-hwdb/sd-hwdb.c | 2 +- src/libsystemd/sd-path/sd-path.c | 6 +- src/locale/localed.c | 4 +- src/locale/meson.build | 4 +- src/login/logind-acl.h | 2 +- src/login/meson.build | 4 +- src/machine/meson.build | 2 +- src/network/meson.build | 2 +- src/network/networkd-manager.c | 2 +- src/nspawn/nspawn-mount.c | 4 +- src/nspawn/nspawn-patch-uid.c | 4 +- src/nspawn/nspawn-seccomp.c | 6 +- src/nspawn/nspawn.c | 10 +- src/quotacheck/quotacheck.c | 4 +- src/resolve/meson.build | 2 +- src/resolve/resolved-conf.c | 2 +- src/resolve/resolved-dns-dnssec.c | 4 +- src/resolve/resolved-link.c | 2 +- src/resolve/resolved-manager.c | 10 +- src/resolve/test-dnssec-complex.c | 2 +- src/resolve/test-dnssec.c | 4 +- src/shared/acl-util.h | 2 +- src/shared/bus-unit-util.c | 2 +- src/shared/bus-util.c | 12 +- src/shared/dissect-image.c | 22 +- src/shared/dns-domain.c | 10 +- src/shared/dns-domain.h | 2 +- src/shared/efivars.c | 2 +- src/shared/efivars.h | 2 +- src/shared/firewall-util.h | 2 +- src/shared/gcrypt-util.c | 2 +- src/shared/gcrypt-util.h | 6 +- src/shared/install.c | 4 +- src/shared/journal-util.c | 4 +- src/shared/meson.build | 8 +- src/shared/path-lookup.c | 2 +- src/shared/spawn-polkit-agent.c | 2 +- src/shared/utmp-wtmp.h | 2 +- src/systemctl/systemctl.c | 18 +- src/sysusers/sysusers.c | 4 +- src/test/test-dns-domain.c | 4 +- src/test/test-execute.c | 10 +- src/test/test-nss.c | 6 +- src/test/test-process-util.c | 6 +- src/test/test-sigbus.c | 4 +- src/timedate/meson.build | 2 +- src/timesync/meson.build | 2 +- src/tmpfiles/tmpfiles.c | 10 +- src/udev/meson.build | 6 +- src/udev/net/link-config.c | 2 +- src/udev/udev-builtin-blkid.c | 2 +- src/udev/udev-builtin-btrfs.c | 2 +- src/udev/udev-builtin.c | 6 +- src/udev/udev.h | 10 +- src/update-utmp/update-utmp.c | 16 +- src/vconsole/meson.build | 2 +- sysctl.d/meson.build | 2 +- sysusers.d/meson.build | 4 +- test/meson.build | 2 +- tmpfiles.d/meson.build | 6 +- units/meson.build | 14 +- 140 files changed, 598 insertions(+), 565 deletions(-) diff --git a/docs/sysvinit/meson.build b/docs/sysvinit/meson.build index 79d1babf167..115ad39ce2f 100644 --- a/docs/sysvinit/meson.build +++ b/docs/sysvinit/meson.build @@ -3,7 +3,7 @@ file = configure_file( output : 'README', configuration : substs) -if conf.get('HAVE_SYSV_COMPAT', false) +if conf.get('HAVE_SYSV_COMPAT') == 1 install_data(file, install_dir : sysvinit_path) endif diff --git a/docs/var-log/meson.build b/docs/var-log/meson.build index d8364e38b97..60acf494ef5 100644 --- a/docs/var-log/meson.build +++ b/docs/var-log/meson.build @@ -3,7 +3,7 @@ file = configure_file( output : 'README', configuration : substs) -if conf.get('HAVE_SYSV_COMPAT', false) +if conf.get('HAVE_SYSV_COMPAT') == 1 install_data(file, install_dir : varlogdir) endif diff --git a/hwdb/meson.build b/hwdb/meson.build index ee206fd509e..a5175039cd9 100644 --- a/hwdb/meson.build +++ b/hwdb/meson.build @@ -18,7 +18,7 @@ hwdb_files = files(''' 70-touchpad.hwdb '''.split()) -if conf.get('ENABLE_HWDB', false) +if conf.get('ENABLE_HWDB') == 1 install_data(hwdb_files, install_dir : udevhwdbdir) diff --git a/man/meson.build b/man/meson.build index 5b6a21fb9f4..7d28e6ba1ad 100644 --- a/man/meson.build +++ b/man/meson.build @@ -51,7 +51,7 @@ foreach tuple : manpages mandirn = join_paths(get_option('mandir'), 'man' + section) - if condition == '' or conf.get(condition, false) + if condition == '' or conf.get(condition) == 1 p1 = custom_target( man, input : xml, diff --git a/meson.build b/meson.build index 7dcbeccb573..2b1da8a41b0 100644 --- a/meson.build +++ b/meson.build @@ -38,8 +38,8 @@ endif ##################################################################### rootprefixdir = get_option('rootprefix') +conf.set10('HAVE_SPLIT_USR', get_option('split-usr')) if get_option('split-usr') - conf.set('HAVE_SPLIT_USR', true) rootprefixdir = rootprefixdir != '' ? rootprefixdir : '/' else rootprefixdir = rootprefixdir != '' ? rootprefixdir : '/usr' @@ -47,11 +47,10 @@ endif sysvinit_path = get_option('sysvinit-path') sysvrcnd_path = get_option('sysvrcnd-path') -if sysvinit_path != '' or sysvrcnd_path != '' - conf.set('HAVE_SYSV_COMPAT', true, - description : 'SysV init scripts and rcN.d links are supported') - m4_defines += ['-DHAVE_SYSV_COMPAT'] -endif +have = sysvinit_path != '' or sysvrcnd_path != '' +conf.set10('HAVE_SYSV_COMPAT', have, + description : 'SysV init scripts and rcN.d links are supported') +m4_defines += have ? ['-DHAVE_SYSV_COMPAT'] : [] # join_paths ignore the preceding arguments if an absolute component is # encountered, so this should canonicalize various paths when they are @@ -390,7 +389,7 @@ foreach decl : ['char16_t', # We get -1 if the size cannot be determined have = cc.sizeof(decl, prefix : decl_headers) > 0 - conf.set('HAVE_' + decl.underscorify().to_upper(), have) + conf.set10('HAVE_' + decl.underscorify().to_upper(), have) endforeach foreach decl : [['IFLA_INET6_ADDR_GEN_MODE', 'linux/if_link.h'], @@ -422,12 +421,8 @@ foreach decl : [['IFLA_INET6_ADDR_GEN_MODE', 'linux/if_link.h'], conf.set10('HAVE_' + decl[0], have) endforeach -skip = false foreach ident : ['secure_getenv', '__secure_getenv'] - if not skip and cc.has_function(ident) - conf.set('HAVE_' + ident.to_upper(), true) - skip = true - endif + conf.set10('HAVE_' + ident.to_upper(), cc.has_function(ident)) endforeach foreach ident : [ @@ -456,10 +451,11 @@ foreach ident : [ endforeach if cc.has_function('getrandom', prefix : '''#include ''') - conf.set('USE_SYS_RANDOM_H', true) + conf.set10('USE_SYS_RANDOM_H', true) conf.set10('HAVE_GETRANDOM', true) else have = cc.has_function('getrandom', prefix : '''#include ''') + conf.set10('USE_SYS_RANDOM_H', false) conf.set10('HAVE_GETRANDOM', have) endif @@ -550,8 +546,8 @@ foreach header : ['linux/btrfs.h', 'valgrind/valgrind.h', ] - conf.set('HAVE_' + header.underscorify().to_upper(), - cc.has_header(header)) + conf.set10('HAVE_' + header.underscorify().to_upper(), + cc.has_header(header)) endforeach ############################################################ @@ -638,17 +634,21 @@ substs.set('SUSHELL', get_option('debug-shell')) substs.set('DEBUGTTY', get_option('debug-tty')) debug = get_option('debug') +enable_debug_hashmap = false +enable_debug_mmap_cache = false if debug != '' foreach name : debug.split(',') if name == 'hashmap' - conf.set('ENABLE_DEBUG_HASHMAP', true) + enable_debug_hashmap = true elif name == 'mmap-cache' - conf.set('ENABLE_DEBUG_MMAP_CACHE', true) + enable_debug_mmap_cache = true else message('unknown debug option "@0@", ignoring'.format(name)) endif endforeach endif +conf.set10('ENABLE_DEBUG_HASHMAP', enable_debug_hashmap) +conf.set10('ENABLE_DEBUG_MMAP_CACHE', enable_debug_mmap_cache) ##################################################################### @@ -672,38 +672,38 @@ if want_seccomp != 'false' libseccomp = dependency('libseccomp', version : '>= 2.3.1', required : want_seccomp == 'true') - if libseccomp.found() - conf.set('HAVE_SECCOMP', true) - m4_defines += ['-DHAVE_SECCOMP'] - endif + have = libseccomp.found() else + have = false libseccomp = [] endif +conf.set10('HAVE_SECCOMP', have) +m4_defines += have ? ['-DHAVE_SECCOMP'] : [] want_selinux = get_option('selinux') if want_selinux != 'false' libselinux = dependency('libselinux', version : '>= 2.1.9', required : want_selinux == 'true') - if libselinux.found() - conf.set('HAVE_SELINUX', true) - m4_defines += ['-DHAVE_SELINUX'] - endif + have = libselinux.found() else + have = false libselinux = [] endif +conf.set10('HAVE_SELINUX', have) +m4_defines += have ? ['-DHAVE_SELINUX'] : [] want_apparmor = get_option('apparmor') if want_apparmor != 'false' libapparmor = dependency('libapparmor', required : want_apparmor == 'true') - if libapparmor.found() - conf.set('HAVE_APPARMOR', true) - m4_defines += ['-DHAVE_APPARMOR'] - endif + have = libapparmor.found() else + have = false libapparmor = [] endif +conf.set10('HAVE_APPARMOR', have) +m4_defines += have ? ['-DHAVE_APPARMOR'] : [] smack_run_label = get_option('smack-run-label') if smack_run_label != '' @@ -715,7 +715,6 @@ want_polkit = get_option('polkit') install_polkit = false install_polkit_pkla = false if want_polkit != 'false' - conf.set('ENABLE_POLKIT', true) install_polkit = true libpolkit = dependency('polkit-gobject-1', @@ -725,92 +724,101 @@ if want_polkit != 'false' install_polkit_pkla = true endif endif +conf.set10('ENABLE_POLKIT', install_polkit) want_acl = get_option('acl') if want_acl != 'false' libacl = cc.find_library('acl', required : want_acl == 'true') - if libacl.found() - conf.set('HAVE_ACL', true) - m4_defines += ['-DHAVE_ACL'] - endif + have = libacl.found() else + have = false libacl = [] endif +conf.set10('HAVE_ACL', have) +m4_defines += have ? ['-DHAVE_ACL'] : [] want_audit = get_option('audit') if want_audit != 'false' libaudit = dependency('audit', required : want_audit == 'true') - conf.set('HAVE_AUDIT', libaudit.found()) + have = libaudit.found() else + have = false libaudit = [] endif +conf.set10('HAVE_AUDIT', have) want_blkid = get_option('blkid') if want_blkid != 'false' libblkid = dependency('blkid', required : want_blkid == 'true') - conf.set('HAVE_BLKID', libblkid.found()) + have = libblkid.found() else + have = false libblkid = [] endif +conf.set10('HAVE_BLKID', have) want_kmod = get_option('kmod') if want_kmod != 'false' libkmod = dependency('libkmod', version : '>= 15', required : want_kmod == 'true') - conf.set('HAVE_KMOD', libkmod.found()) + have = libkmod.found() else + have = false libkmod = [] endif +conf.set10('HAVE_KMOD', have) want_pam = get_option('pam') if want_pam != 'false' libpam = cc.find_library('pam', required : want_pam == 'true') libpam_misc = cc.find_library('pam_misc', required : want_pam == 'true') - if libpam.found() and libpam_misc.found() - conf.set('HAVE_PAM', true) - m4_defines += ['-DHAVE_PAM'] - endif + have = libpam.found() and libpam_misc.found() else + have = false libpam = [] libpam_misc = [] endif +conf.set10('HAVE_PAM', have) +m4_defines += have ? ['-DHAVE_PAM'] : [] want_microhttpd = get_option('microhttpd') if want_microhttpd != 'false' libmicrohttpd = dependency('libmicrohttpd', version : '>= 0.9.33', required : want_microhttpd == 'true') - if libmicrohttpd.found() - conf.set('HAVE_MICROHTTPD', true) - m4_defines += ['-DHAVE_MICROHTTPD'] - endif + have = libmicrohttpd.found() else + have = false libmicrohttpd = [] endif +conf.set10('HAVE_MICROHTTPD', have) +m4_defines += have ? ['-DHAVE_MICROHTTPD'] : [] want_libcryptsetup = get_option('libcryptsetup') if want_libcryptsetup != 'false' libcryptsetup = dependency('libcryptsetup', version : '>= 1.6.0', required : want_libcryptsetup == 'true') - conf.set('HAVE_LIBCRYPTSETUP', libcryptsetup.found()) + have = libcryptsetup.found() else + have = false libcryptsetup = [] endif +conf.set10('HAVE_LIBCRYPTSETUP', have) want_libcurl = get_option('libcurl') if want_libcurl != 'false' libcurl = dependency('libcurl', version : '>= 7.32.0', required : want_libcurl == 'true') - if libcurl.found() - conf.set('HAVE_LIBCURL', true) - m4_defines += ['-DHAVE_LIBCURL'] - endif + have = libcurl.found() else + have = false libcurl = [] endif +conf.set10('HAVE_LIBCURL', have) +m4_defines += have ? ['-DHAVE_LIBCURL'] : [] want_libidn = get_option('libidn') want_libidn2 = get_option('libidn2') @@ -821,125 +829,140 @@ endif if want_libidn != 'false' and want_libidn2 != 'true' libidn = dependency('libidn', required : want_libidn == 'true') - if libidn.found() - conf.set('HAVE_LIBIDN', true) - m4_defines += ['-DHAVE_LIBIDN'] - endif + have = libidn.found() else + have = false libidn = [] endif -if not conf.get('HAVE_LIBIDN', false) and want_libidn2 != 'false' +conf.set10('HAVE_LIBIDN', have) +m4_defines += have ? ['-DHAVE_LIBIDN'] : [] +if not have and want_libidn2 != 'false' # libidn is used for both libidn and libidn2 objects libidn = dependency('libidn2', required : want_libidn2 == 'true') - if libidn.found() - conf.set('HAVE_LIBIDN2', true) - m4_defines += ['-DHAVE_LIBIDN2'] - endif + have = libidn.found() +else + have = false endif +conf.set10('HAVE_LIBIDN2', have) +m4_defines += have ? ['-DHAVE_LIBIDN2'] : [] want_libiptc = get_option('libiptc') if want_libiptc != 'false' libiptc = dependency('libiptc', required : want_libiptc == 'true') - if libiptc.found() - conf.set('HAVE_LIBIPTC', true) - m4_defines += ['-DHAVE_LIBIPTC'] - endif + have = libiptc.found() else + have = false libiptc = [] endif +conf.set10('HAVE_LIBIPTC', have) +m4_defines += have ? ['-DHAVE_LIBIPTC'] : [] want_qrencode = get_option('qrencode') if want_qrencode != 'false' libqrencode = dependency('libqrencode', required : want_qrencode == 'true') - conf.set('HAVE_QRENCODE', libqrencode.found()) + have = libqrencode.found() else + have = false libqrencode = [] endif +conf.set10('HAVE_QRENCODE', have) want_gcrypt = get_option('gcrypt') if want_gcrypt != 'false' libgcrypt = cc.find_library('gcrypt', required : want_gcrypt == 'true') libgpg_error = cc.find_library('gpg-error', required : want_gcrypt == 'true') - - have_deps = libgcrypt.found() and libgpg_error.found() - conf.set('HAVE_GCRYPT', have_deps) - if not have_deps - # link to neither of the libs if one is not found - libgcrypt = [] - libgpg_error = [] - endif + have = libgcrypt.found() and libgpg_error.found() else + have = false +endif +if not have + # link to neither of the libs if one is not found libgcrypt = [] libgpg_error = [] endif +conf.set10('HAVE_GCRYPT', have) want_gnutls = get_option('gnutls') if want_gnutls != 'false' libgnutls = dependency('gnutls', version : '>= 3.1.4', required : want_gnutls == 'true') - conf.set('HAVE_GNUTLS', libgnutls.found()) + have = libgnutls.found() else + have = false libgnutls = [] endif +conf.set10('HAVE_GNUTLS', have) want_elfutils = get_option('elfutils') if want_elfutils != 'false' libdw = dependency('libdw', required : want_elfutils == 'true') - conf.set('HAVE_ELFUTILS', libdw.found()) + have = libdw.found() else + have = false libdw = [] endif +conf.set10('HAVE_ELFUTILS', have) want_zlib = get_option('zlib') if want_zlib != 'false' libz = dependency('zlib', required : want_zlib == 'true') - conf.set('HAVE_ZLIB', libz.found()) + have = libz.found() else + have = false libz = [] endif +conf.set10('HAVE_ZLIB', have) want_bzip2 = get_option('bzip2') if want_bzip2 != 'false' libbzip2 = cc.find_library('bz2', required : want_bzip2 == 'true') - conf.set('HAVE_BZIP2', libbzip2.found()) + have = libbzip2.found() else + have = false libbzip2 = [] endif +conf.set10('HAVE_BZIP2', have) want_xz = get_option('xz') if want_xz != 'false' libxz = dependency('liblzma', required : want_xz == 'true') - conf.set('HAVE_XZ', libxz.found()) + have = libxz.found() else + have = false libxz = [] endif +conf.set10('HAVE_XZ', have) want_lz4 = get_option('lz4') if want_lz4 != 'false' liblz4 = dependency('liblz4', required : want_lz4 == 'true') - conf.set('HAVE_LZ4', liblz4.found()) + have = liblz4.found() else + have = false liblz4 = [] endif +conf.set10('HAVE_LZ4', have) want_xkbcommon = get_option('xkbcommon') if want_xkbcommon != 'false' libxkbcommon = dependency('xkbcommon', version : '>= 0.3.0', required : want_xkbcommon == 'true') - conf.set('HAVE_XKBCOMMON', libxkbcommon.found()) + have = libxkbcommon.found() else + have = false libxkbcommon = [] endif +conf.set10('HAVE_XKBCOMMON', have) want_glib = get_option('glib') if want_glib != 'false' @@ -952,25 +975,28 @@ if want_glib != 'false' libgio = dependency('gio-2.0', required : want_glib == 'true') have = libglib.found() and libgobject.found() and libgio.found() - conf.set('HAVE_GLIB', have) else + have = false libglib = [] libgobject = [] libgio = [] endif +conf.set10('HAVE_GLIB', have) want_dbus = get_option('dbus') if want_dbus != 'false' libdbus = dependency('dbus-1', version : '>= 1.3.2', required : want_dbus == 'true') - conf.set('HAVE_DBUS', libdbus.found()) + have = libdbus.found() else + have = false libdbus = [] endif +conf.set10('HAVE_DBUS', have) default_dnssec = get_option('default-dnssec') -if default_dnssec != 'no' and not conf.get('HAVE_GCRYPT', false) +if default_dnssec != 'no' and conf.get('HAVE_GCRYPT') == 0 message('default-dnssec cannot be set to yes or allow-downgrade when gcrypt is disabled. Setting default-dnssec to no.') default_dnssec = 'no' endif @@ -980,21 +1006,23 @@ substs.set('DEFAULT_DNSSEC_MODE', default_dnssec) want_importd = get_option('importd') if want_importd != 'false' - have_deps = (conf.get('HAVE_LIBCURL', false) and - conf.get('HAVE_ZLIB', false) and - conf.get('HAVE_BZIP2', false) and - conf.get('HAVE_XZ', false) and - conf.get('HAVE_GCRYPT', false)) - conf.set('ENABLE_IMPORTD', have_deps) - if want_importd == 'true' and not have_deps + have = (conf.get('HAVE_LIBCURL') == 1 and + conf.get('HAVE_ZLIB') == 1 and + conf.get('HAVE_BZIP2') == 1 and + conf.get('HAVE_XZ') == 1 and + conf.get('HAVE_GCRYPT') == 1) + if want_importd == 'true' and not have error('importd support was requested, but dependencies are not available') endif +else + have = false endif +conf.set10('ENABLE_IMPORTD', have) want_remote = get_option('remote') if want_remote != 'false' - have_deps = [conf.get('HAVE_MICROHTTPD', false), - conf.get('HAVE_LIBCURL', false)] + have_deps = [conf.get('HAVE_MICROHTTPD') == 1, + conf.get('HAVE_LIBCURL') == 1] # sd-j-remote requires µhttpd, and sd-j-upload requires libcurl, so # it's possible to build one without the other. Complain only if # support was explictly requested. The auxiliary files like sysusers @@ -1002,8 +1030,11 @@ if want_remote != 'false' if want_remote == 'true' and not (have_deps[0] and have_deps[1]) error('remote support was requested, but dependencies are not available') endif - conf.set('ENABLE_REMOTE', have_deps[0] or have_deps[1]) + have = have_deps[0] or have_deps[1] +else + have = false endif +conf.set10('ENABLE_REMOTE', have) foreach pair : [['utmp', 'HAVE_UTMP'], ['hibernate', 'ENABLE_HIBERNATE'], @@ -1038,10 +1069,9 @@ foreach pair : [['utmp', 'HAVE_UTMP'], ['nss-systemd', 'ENABLE_NSS_SYSTEMD'], ] - if get_option(pair[0]) - conf.set(pair[1], true) - m4_defines += ['-D' + pair[1]] - endif + have = get_option(pair[0]) + conf.set10(pair[1], have) + m4_defines += have ? ['-D' + pair[1]] : [] endforeach want_tests = get_option('tests') @@ -1072,11 +1102,14 @@ if get_option('efi') gnu_efi_arch = '' endif - conf.set('ENABLE_EFI', true) + have = true conf.set_quoted('EFI_MACHINE_TYPE_NAME', EFI_MACHINE_TYPE_NAME) conf.set('SD_TPM_PCR', get_option('tpm-pcrindex').to_int()) +else + have = false endif +conf.set10('ENABLE_EFI', have) ##################################################################### @@ -1191,7 +1224,7 @@ foreach tuple : [['myhostname', 'HAVE_MYHOSTNAME'], ['mymachines', 'ENABLE_MACHINED'], ['resolve', 'ENABLE_RESOLVED']] - condition = tuple[1] == '' or conf.get(tuple[1], false) + condition = tuple[1] == '' or conf.get(tuple[1]) == 1 if condition module = tuple[0] @@ -1319,7 +1352,7 @@ executable('systemd-fstab-generator', install : true, install_dir : systemgeneratordir) -if conf.get('ENABLE_ENVIRONMENT_D', false) +if conf.get('ENABLE_ENVIRONMENT_D') == 1 executable('30-systemd-environment-d-generator', 'src/environment-d-generator/environment-d-generator.c', include_directories : includes, @@ -1333,7 +1366,7 @@ if conf.get('ENABLE_ENVIRONMENT_D', false) join_paths(environmentdir, '99-environment.conf')) endif -if conf.get('ENABLE_HIBERNATE', false) +if conf.get('ENABLE_HIBERNATE') == 1 executable('systemd-hibernate-resume-generator', 'src/hibernate-resume/hibernate-resume-generator.c', include_directories : includes, @@ -1351,7 +1384,7 @@ if conf.get('ENABLE_HIBERNATE', false) install_dir : rootlibexecdir) endif -if conf.get('HAVE_BLKID', false) +if conf.get('HAVE_BLKID') == 1 executable('systemd-gpt-auto-generator', 'src/gpt-auto-generator/gpt-auto-generator.c', 'src/basic/blkid-util.h', @@ -1372,7 +1405,7 @@ if conf.get('HAVE_BLKID', false) public_programs += [exe] endif -if conf.get('ENABLE_RESOLVED', false) +if conf.get('ENABLE_RESOLVED') == 1 executable('systemd-resolved', systemd_resolved_sources, gcrypt_util_sources, @@ -1402,7 +1435,7 @@ if conf.get('ENABLE_RESOLVED', false) public_programs += [exe] endif -if conf.get('ENABLE_LOGIND', false) +if conf.get('ENABLE_LOGIND') == 1 executable('systemd-logind', systemd_logind_sources, include_directories : includes, @@ -1435,7 +1468,7 @@ if conf.get('ENABLE_LOGIND', false) install_dir : rootbindir) public_programs += [exe] - if conf.get('HAVE_PAM', false) + if conf.get('HAVE_PAM') == 1 version_script_arg = join_paths(meson.current_source_dir(), pam_systemd_sym) pam_systemd = shared_library( 'pam_systemd', @@ -1459,7 +1492,7 @@ if conf.get('ENABLE_LOGIND', false) endif endif -if conf.get('HAVE_PAM', false) +if conf.get('HAVE_PAM') == 1 executable('systemd-user-sessions', 'src/user-sessions/user-sessions.c', include_directories : includes, @@ -1469,7 +1502,7 @@ if conf.get('HAVE_PAM', false) install_dir : rootlibexecdir) endif -if conf.get('ENABLE_EFI', false) and conf.get('HAVE_BLKID', false) +if conf.get('ENABLE_EFI') == 1 and conf.get('HAVE_BLKID') == 1 exe = executable('bootctl', 'src/boot/bootctl.c', include_directories : includes, @@ -1501,7 +1534,7 @@ exe = executable('systemctl', 'src/systemctl/systemctl.c', install_dir : rootbindir) public_programs += [exe] -if conf.get('ENABLE_BACKLIGHT', false) +if conf.get('ENABLE_BACKLIGHT') == 1 executable('systemd-backlight', 'src/backlight/backlight.c', include_directories : includes, @@ -1511,7 +1544,7 @@ if conf.get('ENABLE_BACKLIGHT', false) install_dir : rootlibexecdir) endif -if conf.get('ENABLE_RFKILL', false) +if conf.get('ENABLE_RFKILL') == 1 executable('systemd-rfkill', 'src/rfkill/rfkill.c', include_directories : includes, @@ -1529,7 +1562,7 @@ executable('systemd-system-update-generator', install : true, install_dir : systemgeneratordir) -if conf.get('HAVE_LIBCRYPTSETUP', false) +if conf.get('HAVE_LIBCRYPTSETUP') == 1 executable('systemd-cryptsetup', 'src/cryptsetup/cryptsetup.c', include_directories : includes, @@ -1567,7 +1600,7 @@ if conf.get('HAVE_LIBCRYPTSETUP', false) install_dir : systemgeneratordir) endif -if conf.get('HAVE_SYSV_COMPAT', false) +if conf.get('HAVE_SYSV_COMPAT') == 1 executable('systemd-sysv-generator', 'src/sysv-generator/sysv-generator.c', include_directories : includes, @@ -1585,7 +1618,7 @@ if conf.get('HAVE_SYSV_COMPAT', false) install_dir : systemgeneratordir) endif -if conf.get('ENABLE_HOSTNAMED', false) +if conf.get('ENABLE_HOSTNAMED') == 1 executable('systemd-hostnamed', 'src/hostname/hostnamed.c', include_directories : includes, @@ -1603,8 +1636,8 @@ if conf.get('ENABLE_HOSTNAMED', false) public_programs += [exe] endif -if conf.get('ENABLE_LOCALED', false) - if conf.get('HAVE_XKBCOMMON', false) +if conf.get('ENABLE_LOCALED') == 1 + if conf.get('HAVE_XKBCOMMON') == 1 # logind will load libxkbcommon.so dynamically on its own deps = [libdl] else @@ -1629,7 +1662,7 @@ if conf.get('ENABLE_LOCALED', false) public_programs += [exe] endif -if conf.get('ENABLE_TIMEDATED', false) +if conf.get('ENABLE_TIMEDATED') == 1 executable('systemd-timedated', 'src/timedate/timedated.c', include_directories : includes, @@ -1647,7 +1680,7 @@ if conf.get('ENABLE_TIMEDATED', false) public_programs += [exe] endif -if conf.get('ENABLE_TIMESYNCD', false) +if conf.get('ENABLE_TIMESYNCD') == 1 executable('systemd-timesyncd', systemd_timesyncd_sources, include_directories : includes, @@ -1659,7 +1692,7 @@ if conf.get('ENABLE_TIMESYNCD', false) install_dir : rootlibexecdir) endif -if conf.get('ENABLE_MACHINED', false) +if conf.get('ENABLE_MACHINED') == 1 executable('systemd-machined', systemd_machined_sources, include_directories : includes, @@ -1682,7 +1715,7 @@ if conf.get('ENABLE_MACHINED', false) public_programs += [exe] endif -if conf.get('ENABLE_IMPORTD', false) +if conf.get('ENABLE_IMPORTD') == 1 executable('systemd-importd', systemd_importd_sources, include_directories : includes, @@ -1731,7 +1764,7 @@ if conf.get('ENABLE_IMPORTD', false) public_programs += [systemd_pull, systemd_import, systemd_export] endif -if conf.get('ENABLE_REMOTE', false) and conf.get('HAVE_LIBCURL', false) +if conf.get('ENABLE_REMOTE') == 1 and conf.get('HAVE_LIBCURL') == 1 exe = executable('systemd-journal-upload', systemd_journal_upload_sources, include_directories : includes, @@ -1747,7 +1780,7 @@ if conf.get('ENABLE_REMOTE', false) and conf.get('HAVE_LIBCURL', false) public_programs += [exe] endif -if conf.get('ENABLE_REMOTE', false) and conf.get('HAVE_MICROHTTPD', false) +if conf.get('ENABLE_REMOTE') == 1 and conf.get('HAVE_MICROHTTPD') == 1 s_j_remote = executable('systemd-journal-remote', systemd_journal_remote_sources, include_directories : includes, @@ -1776,7 +1809,7 @@ if conf.get('ENABLE_REMOTE', false) and conf.get('HAVE_MICROHTTPD', false) public_programs += [s_j_remote, s_j_gatewayd] endif -if conf.get('ENABLE_COREDUMP', false) +if conf.get('ENABLE_COREDUMP') == 1 executable('systemd-coredump', systemd_coredump_sources, include_directories : includes, @@ -1802,7 +1835,7 @@ if conf.get('ENABLE_COREDUMP', false) public_programs += [exe] endif -if conf.get('ENABLE_BINFMT', false) +if conf.get('ENABLE_BINFMT') == 1 exe = executable('systemd-binfmt', 'src/binfmt/binfmt.c', include_directories : includes, @@ -1818,7 +1851,7 @@ if conf.get('ENABLE_BINFMT', false) mkdir_p.format(join_paths(sysconfdir, 'binfmt.d'))) endif -if conf.get('ENABLE_VCONSOLE', false) +if conf.get('ENABLE_VCONSOLE') == 1 executable('systemd-vconsole-setup', 'src/vconsole/vconsole-setup.c', include_directories : includes, @@ -1828,7 +1861,7 @@ if conf.get('ENABLE_VCONSOLE', false) install_dir : rootlibexecdir) endif -if conf.get('ENABLE_RANDOMSEED', false) +if conf.get('ENABLE_RANDOMSEED') == 1 executable('systemd-random-seed', 'src/random-seed/random-seed.c', include_directories : includes, @@ -1838,7 +1871,7 @@ if conf.get('ENABLE_RANDOMSEED', false) install_dir : rootlibexecdir) endif -if conf.get('ENABLE_FIRSTBOOT', false) +if conf.get('ENABLE_FIRSTBOOT') == 1 executable('systemd-firstboot', 'src/firstboot/firstboot.c', include_directories : includes, @@ -2047,7 +2080,7 @@ exe = executable('busctl', install : true) public_programs += [exe] -if conf.get('ENABLE_SYSUSERS', false) +if conf.get('ENABLE_SYSUSERS') == 1 exe = executable('systemd-sysusers', 'src/sysusers/sysusers.c', include_directories : includes, @@ -2058,7 +2091,7 @@ if conf.get('ENABLE_SYSUSERS', false) public_programs += [exe] endif -if conf.get('ENABLE_TMPFILES', false) +if conf.get('ENABLE_TMPFILES') == 1 exe = executable('systemd-tmpfiles', 'src/tmpfiles/tmpfiles.c', include_directories : includes, @@ -2070,7 +2103,7 @@ if conf.get('ENABLE_TMPFILES', false) public_programs += [exe] endif -if conf.get('ENABLE_HWDB', false) +if conf.get('ENABLE_HWDB') == 1 exe = executable('systemd-hwdb', 'src/hwdb/hwdb.c', 'src/libsystemd/sd-hwdb/hwdb-internal.h', @@ -2082,7 +2115,7 @@ if conf.get('ENABLE_HWDB', false) public_programs += [exe] endif -if conf.get('ENABLE_QUOTACHECK', false) +if conf.get('ENABLE_QUOTACHECK') == 1 executable('systemd-quotacheck', 'src/quotacheck/quotacheck.c', include_directories : includes, @@ -2160,7 +2193,7 @@ executable('systemd-update-utmp', install : true, install_dir : rootlibexecdir) -if conf.get('HAVE_KMOD', false) +if conf.get('HAVE_KMOD') == 1 executable('systemd-modules-load', 'src/modules-load/modules-load.c', include_directories : includes, @@ -2192,7 +2225,7 @@ exe = executable('systemd-nspawn', install : true) public_programs += [exe] -if conf.get('ENABLE_NETWORKD', false) +if conf.get('ENABLE_NETWORKD') == 1 executable('systemd-networkd', systemd_networkd_sources, include_directories : includes, @@ -2242,7 +2275,7 @@ foreach tuple : tests type = '' endif - if condition == '' or conf.get(condition, false) + if condition == '' or conf.get(condition) == 1 exe = executable( name, sources, @@ -2448,7 +2481,7 @@ status += [ # CPPFLAGS: ${OUR_CPPFLAGS} ${CPPFLAGS} # LDFLAGS: ${OUR_LDFLAGS} ${LDFLAGS} -if conf.get('ENABLE_EFI', false) +if conf.get('ENABLE_EFI') == 1 status += [ 'efi arch: @0@'.format(efi_arch)] @@ -2519,13 +2552,13 @@ foreach tuple : [ ['blkid'], ['dbus'], ['glib'], - ['nss-myhostname', conf.get('HAVE_MYHOSTNAME', false)], + ['nss-myhostname', conf.get('HAVE_MYHOSTNAME') == 1], ['hwdb'], ['tpm'], ['man pages', want_man], ['html pages', want_html], ['man page indices', want_man and have_lxml], - ['split /usr', conf.get('HAVE_SPLIT_USR', false)], + ['split /usr', conf.get('HAVE_SPLIT_USR') == 1], ['SysV compat'], ['utmp'], ['ldconfig'], @@ -2541,7 +2574,7 @@ foreach tuple : [ if cond == '' ident1 = 'HAVE_' + tuple[0].underscorify().to_upper() ident2 = 'ENABLE_' + tuple[0].underscorify().to_upper() - cond = conf.get(ident1, false) or conf.get(ident2, false) + cond = conf.get(ident1, 0) == 1 or conf.get(ident2, 0) == 1 endif if cond found += [tuple[0]] diff --git a/network/meson.build b/network/meson.build index e9f9bbae427..4c33e45a166 100644 --- a/network/meson.build +++ b/network/meson.build @@ -1,4 +1,4 @@ -if conf.get('ENABLE_NETWORKD', false) +if conf.get('ENABLE_NETWORKD') == 1 install_data('80-container-host0.network', '80-container-ve.network', '80-container-vz.network', diff --git a/shell-completion/bash/meson.build b/shell-completion/bash/meson.build index 93996618457..1b25e266750 100644 --- a/shell-completion/bash/meson.build +++ b/shell-completion/bash/meson.build @@ -42,7 +42,7 @@ if bashcompletiondir != 'no' ] foreach item : items - if item[1] == '' or conf.get(item[1], false) + if item[1] == '' or conf.get(item[1]) == 1 install_data(item[0], install_dir : bashcompletiondir) endif diff --git a/shell-completion/zsh/meson.build b/shell-completion/zsh/meson.build index 34408ce90da..a3a821e0b11 100644 --- a/shell-completion/zsh/meson.build +++ b/shell-completion/zsh/meson.build @@ -39,7 +39,7 @@ if zshcompletiondir != 'no' ] foreach item : items - if item[1] == '' or conf.get(item[1], false) + if item[1] == '' or conf.get(item[1]) == 1 install_data(item[0], install_dir : zshcompletiondir) endif diff --git a/src/analyze/analyze.c b/src/analyze/analyze.c index 0e0fb08922c..9fcc20dba3d 100644 --- a/src/analyze/analyze.c +++ b/src/analyze/analyze.c @@ -36,7 +36,7 @@ #include "log.h" #include "pager.h" #include "parse-util.h" -#ifdef HAVE_SECCOMP +#if HAVE_SECCOMP #include "seccomp-util.h" #endif #include "special.h" @@ -1337,7 +1337,7 @@ static int get_log_target(sd_bus *bus, char **args) { return 0; } -#ifdef HAVE_SECCOMP +#if HAVE_SECCOMP static void dump_syscall_filter(const SyscallFilterSet *set) { const char *syscall; diff --git a/src/basic/blkid-util.h b/src/basic/blkid-util.h index 1b9cace0407..53340ec6f36 100644 --- a/src/basic/blkid-util.h +++ b/src/basic/blkid-util.h @@ -19,13 +19,13 @@ along with systemd; If not, see . ***/ -#ifdef HAVE_BLKID +#if HAVE_BLKID #include #endif #include "util.h" -#ifdef HAVE_BLKID +#if HAVE_BLKID DEFINE_TRIVIAL_CLEANUP_FUNC(blkid_probe, blkid_free_probe); #define _cleanup_blkid_free_probe_ _cleanup_(blkid_free_probep) #endif diff --git a/src/basic/btrfs-util.c b/src/basic/btrfs-util.c index 55054993125..c2061addd17 100644 --- a/src/basic/btrfs-util.c +++ b/src/basic/btrfs-util.c @@ -32,7 +32,7 @@ #include #include -#ifdef HAVE_LINUX_BTRFS_H +#if HAVE_LINUX_BTRFS_H #include #endif diff --git a/src/basic/build.h b/src/basic/build.h index 3223915da61..8ca8f706cbc 100644 --- a/src/basic/build.h +++ b/src/basic/build.h @@ -19,121 +19,121 @@ along with systemd; If not, see . ***/ -#ifdef HAVE_PAM +#if HAVE_PAM #define _PAM_FEATURE_ "+PAM" #else #define _PAM_FEATURE_ "-PAM" #endif -#ifdef HAVE_AUDIT +#if HAVE_AUDIT #define _AUDIT_FEATURE_ "+AUDIT" #else #define _AUDIT_FEATURE_ "-AUDIT" #endif -#ifdef HAVE_SELINUX +#if HAVE_SELINUX #define _SELINUX_FEATURE_ "+SELINUX" #else #define _SELINUX_FEATURE_ "-SELINUX" #endif -#ifdef HAVE_APPARMOR +#if HAVE_APPARMOR #define _APPARMOR_FEATURE_ "+APPARMOR" #else #define _APPARMOR_FEATURE_ "-APPARMOR" #endif -#ifdef HAVE_IMA +#if HAVE_IMA #define _IMA_FEATURE_ "+IMA" #else #define _IMA_FEATURE_ "-IMA" #endif -#ifdef HAVE_SMACK +#if HAVE_SMACK #define _SMACK_FEATURE_ "+SMACK" #else #define _SMACK_FEATURE_ "-SMACK" #endif -#ifdef HAVE_SYSV_COMPAT +#if HAVE_SYSV_COMPAT #define _SYSVINIT_FEATURE_ "+SYSVINIT" #else #define _SYSVINIT_FEATURE_ "-SYSVINIT" #endif -#ifdef HAVE_UTMP +#if HAVE_UTMP #define _UTMP_FEATURE_ "+UTMP" #else #define _UTMP_FEATURE_ "-UTMP" #endif -#ifdef HAVE_LIBCRYPTSETUP +#if HAVE_LIBCRYPTSETUP #define _LIBCRYPTSETUP_FEATURE_ "+LIBCRYPTSETUP" #else #define _LIBCRYPTSETUP_FEATURE_ "-LIBCRYPTSETUP" #endif -#ifdef HAVE_GCRYPT +#if HAVE_GCRYPT #define _GCRYPT_FEATURE_ "+GCRYPT" #else #define _GCRYPT_FEATURE_ "-GCRYPT" #endif -#ifdef HAVE_GNUTLS +#if HAVE_GNUTLS #define _GNUTLS_FEATURE_ "+GNUTLS" #else #define _GNUTLS_FEATURE_ "-GNUTLS" #endif -#ifdef HAVE_ACL +#if HAVE_ACL #define _ACL_FEATURE_ "+ACL" #else #define _ACL_FEATURE_ "-ACL" #endif -#ifdef HAVE_XZ +#if HAVE_XZ #define _XZ_FEATURE_ "+XZ" #else #define _XZ_FEATURE_ "-XZ" #endif -#ifdef HAVE_LZ4 +#if HAVE_LZ4 #define _LZ4_FEATURE_ "+LZ4" #else #define _LZ4_FEATURE_ "-LZ4" #endif -#ifdef HAVE_SECCOMP +#if HAVE_SECCOMP #define _SECCOMP_FEATURE_ "+SECCOMP" #else #define _SECCOMP_FEATURE_ "-SECCOMP" #endif -#ifdef HAVE_BLKID +#if HAVE_BLKID #define _BLKID_FEATURE_ "+BLKID" #else #define _BLKID_FEATURE_ "-BLKID" #endif -#ifdef HAVE_ELFUTILS +#if HAVE_ELFUTILS #define _ELFUTILS_FEATURE_ "+ELFUTILS" #else #define _ELFUTILS_FEATURE_ "-ELFUTILS" #endif -#ifdef HAVE_KMOD +#if HAVE_KMOD #define _KMOD_FEATURE_ "+KMOD" #else #define _KMOD_FEATURE_ "-KMOD" #endif -#ifdef HAVE_LIBIDN2 +#if HAVE_LIBIDN2 #define _IDN2_FEATURE_ "+IDN2" #else #define _IDN2_FEATURE_ "-IDN2" #endif -#ifdef HAVE_LIBIDN +#if HAVE_LIBIDN #define _IDN_FEATURE_ "+IDN" #else #define _IDN_FEATURE_ "-IDN" diff --git a/src/basic/def.h b/src/basic/def.h index d3f5381e1ba..c04e58b57a9 100644 --- a/src/basic/def.h +++ b/src/basic/def.h @@ -43,7 +43,7 @@ #define SIGNALS_CRASH_HANDLER SIGSEGV,SIGILL,SIGFPE,SIGBUS,SIGQUIT,SIGABRT #define SIGNALS_IGNORE SIGPIPE -#ifdef HAVE_SPLIT_USR +#if HAVE_SPLIT_USR #define KBD_KEYMAP_DIRS \ "/usr/share/keymaps/\0" \ "/usr/share/kbd/keymaps/\0" \ @@ -68,7 +68,7 @@ #define NOTIFY_FD_MAX 768 #define NOTIFY_BUFFER_MAX PIPE_BUF -#ifdef HAVE_SPLIT_USR +#if HAVE_SPLIT_USR # define _CONF_PATHS_SPLIT_USR(n) "/lib/" n "\0" #else # define _CONF_PATHS_SPLIT_USR(n) diff --git a/src/basic/hashmap.c b/src/basic/hashmap.c index 6ef1b0ba358..289c2ad2c35 100644 --- a/src/basic/hashmap.c +++ b/src/basic/hashmap.c @@ -34,7 +34,7 @@ #include "strv.h" #include "util.h" -#ifdef ENABLE_DEBUG_HASHMAP +#if ENABLE_DEBUG_HASHMAP #include #include "list.h" #endif @@ -142,7 +142,7 @@ typedef uint8_t dib_raw_t; #define DIB_FREE UINT_MAX -#ifdef ENABLE_DEBUG_HASHMAP +#if ENABLE_DEBUG_HASHMAP struct hashmap_debug_info { LIST_FIELDS(struct hashmap_debug_info, debug_list); unsigned max_entries; /* high watermark of n_entries */ @@ -499,7 +499,7 @@ static void base_remove_entry(HashmapBase *h, unsigned idx) { dibs = dib_raw_ptr(h); assert(dibs[idx] != DIB_RAW_FREE); -#ifdef ENABLE_DEBUG_HASHMAP +#if ENABLE_DEBUG_HASHMAP h->debug.rem_count++; h->debug.last_rem_idx = idx; #endif @@ -578,7 +578,7 @@ static unsigned hashmap_iterate_in_insertion_order(OrderedHashmap *h, Iterator * assert(e->p.b.key == i->next_key); } -#ifdef ENABLE_DEBUG_HASHMAP +#if ENABLE_DEBUG_HASHMAP i->prev_idx = idx; #endif @@ -635,7 +635,7 @@ static unsigned hashmap_iterate_in_internal_order(HashmapBase *h, Iterator *i) { } idx = i->idx; -#ifdef ENABLE_DEBUG_HASHMAP +#if ENABLE_DEBUG_HASHMAP i->prev_idx = idx; #endif @@ -658,7 +658,7 @@ static unsigned hashmap_iterate_entry(HashmapBase *h, Iterator *i) { return IDX_NIL; } -#ifdef ENABLE_DEBUG_HASHMAP +#if ENABLE_DEBUG_HASHMAP if (i->idx == IDX_FIRST) { i->put_count = h->debug.put_count; i->rem_count = h->debug.rem_count; @@ -750,7 +750,7 @@ static struct HashmapBase *hashmap_base_new(const struct hash_ops *hash_ops, enu shared_hash_key_initialized= true; } -#ifdef ENABLE_DEBUG_HASHMAP +#if ENABLE_DEBUG_HASHMAP h->debug.func = func; h->debug.file = file; h->debug.line = line; @@ -807,7 +807,7 @@ static void hashmap_free_no_clear(HashmapBase *h) { assert(!h->has_indirect); assert(!h->n_direct_entries); -#ifdef ENABLE_DEBUG_HASHMAP +#if ENABLE_DEBUG_HASHMAP assert_se(pthread_mutex_lock(&hashmap_debug_list_mutex) == 0); LIST_REMOVE(debug_list, hashmap_debug_list, &h->debug); assert_se(pthread_mutex_unlock(&hashmap_debug_list_mutex) == 0); @@ -919,7 +919,7 @@ static bool hashmap_put_robin_hood(HashmapBase *h, unsigned idx, dib_raw_t raw_dib, *dibs; unsigned dib, distance; -#ifdef ENABLE_DEBUG_HASHMAP +#if ENABLE_DEBUG_HASHMAP h->debug.put_count++; #endif @@ -1012,7 +1012,7 @@ static int hashmap_base_put_boldly(HashmapBase *h, unsigned idx, assert_se(hashmap_put_robin_hood(h, idx, swap) == false); n_entries_inc(h); -#ifdef ENABLE_DEBUG_HASHMAP +#if ENABLE_DEBUG_HASHMAP h->debug.max_entries = MAX(h->debug.max_entries, n_entries(h)); #endif @@ -1240,7 +1240,7 @@ int hashmap_replace(Hashmap *h, const void *key, void *value) { idx = bucket_scan(h, hash, key); if (idx != IDX_NIL) { e = plain_bucket_at(h, idx); -#ifdef ENABLE_DEBUG_HASHMAP +#if ENABLE_DEBUG_HASHMAP /* Although the key is equal, the key pointer may have changed, * and this would break our assumption for iterating. So count * this operation as incompatible with iteration. */ diff --git a/src/basic/hashmap.h b/src/basic/hashmap.h index 6d1ae48b213..c1089652d32 100644 --- a/src/basic/hashmap.h +++ b/src/basic/hashmap.h @@ -58,7 +58,7 @@ typedef struct Set Set; /* Stores just keys */ typedef struct { unsigned idx; /* index of an entry to be iterated next */ const void *next_key; /* expected value of that entry's key pointer */ -#ifdef ENABLE_DEBUG_HASHMAP +#if ENABLE_DEBUG_HASHMAP unsigned put_count; /* hashmap's put_count recorded at start of iteration */ unsigned rem_count; /* hashmap's rem_count in previous iteration */ unsigned prev_idx; /* idx in previous iteration */ @@ -89,7 +89,7 @@ typedef struct { (Hashmap*)(h), \ (void)0) -#ifdef ENABLE_DEBUG_HASHMAP +#if ENABLE_DEBUG_HASHMAP # define HASHMAP_DEBUG_PARAMS , const char *func, const char *file, int line # define HASHMAP_DEBUG_SRC_ARGS , __func__, __FILE__, __LINE__ # define HASHMAP_DEBUG_PASS_ARGS , func, file, line diff --git a/src/basic/memfd-util.c b/src/basic/memfd-util.c index 8c8cc78ebf9..8f4f0e3a248 100644 --- a/src/basic/memfd-util.c +++ b/src/basic/memfd-util.c @@ -21,7 +21,7 @@ #include #include #include -#ifdef HAVE_LINUX_MEMFD_H +#if HAVE_LINUX_MEMFD_H #include #endif #include diff --git a/src/basic/missing.h b/src/basic/missing.h index 2523b28fa15..352d2b024bc 100644 --- a/src/basic/missing.h +++ b/src/basic/missing.h @@ -40,7 +40,7 @@ #include #include -#ifdef HAVE_AUDIT +#if HAVE_AUDIT #include #endif @@ -48,11 +48,11 @@ #include #endif -#ifdef HAVE_LINUX_BTRFS_H +#if HAVE_LINUX_BTRFS_H #include #endif -#ifdef HAVE_LINUX_VM_SOCKETS_H +#if HAVE_LINUX_VM_SOCKETS_H #include #else #define VMADDR_CID_ANY -1U @@ -204,7 +204,7 @@ struct sockaddr_vm { #define BTRFS_QGROUP_LEVEL_SHIFT 48 #endif -#ifndef HAVE_LINUX_BTRFS_H +#if ! HAVE_LINUX_BTRFS_H struct btrfs_ioctl_vol_args { int64_t fd; char name[BTRFS_PATH_NAME_MAX + 1]; @@ -546,8 +546,8 @@ struct btrfs_ioctl_quota_ctl_args { #define MAX_HANDLE_SZ 128 #endif -#ifndef HAVE_SECURE_GETENV -# ifdef HAVE___SECURE_GETENV +#if ! HAVE_SECURE_GETENV +# if HAVE___SECURE_GETENV # define secure_getenv __secure_getenv # else # error "neither secure_getenv nor __secure_getenv are available" @@ -1108,7 +1108,7 @@ struct input_mask { #define KEY_ALS_TOGGLE 0x230 #endif -#ifndef HAVE_KEY_SERIAL_T +#if ! HAVE_KEY_SERIAL_T typedef int32_t key_serial_t; #endif @@ -1204,11 +1204,11 @@ typedef int32_t key_serial_t; #ifndef IF_OPER_UP #define IF_OPER_UP 6 -#ifndef HAVE_CHAR32_T +#if ! HAVE_CHAR32_T #define char32_t uint32_t #endif -#ifndef HAVE_CHAR16_T +#if ! HAVE_CHAR16_T #define char16_t uint16_t #endif @@ -1220,7 +1220,7 @@ typedef int32_t key_serial_t; #define IFA_F_MCAUTOJOIN 0x400 #endif -#ifndef HAVE_STRUCT_ETHTOOL_LINK_SETTINGS +#if ! HAVE_STRUCT_ETHTOOL_LINK_SETTINGS #define ETHTOOL_GLINKSETTINGS 0x0000004c /* Get ethtool_link_settings */ #define ETHTOOL_SLINKSETTINGS 0x0000004d /* Set ethtool_link_settings */ @@ -1247,7 +1247,7 @@ struct ethtool_link_settings { #endif -#ifndef HAVE_STRUCT_FIB_RULE_UID_RANGE +#if ! HAVE_STRUCT_FIB_RULE_UID_RANGE struct fib_rule_uid_range { __u32 start; diff --git a/src/basic/path-util.h b/src/basic/path-util.h index ea009558186..546246595c2 100644 --- a/src/basic/path-util.h +++ b/src/basic/path-util.h @@ -30,7 +30,7 @@ #define DEFAULT_PATH_NORMAL "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin" #define DEFAULT_PATH_SPLIT_USR DEFAULT_PATH_NORMAL ":/sbin:/bin" -#ifdef HAVE_SPLIT_USR +#if HAVE_SPLIT_USR # define DEFAULT_PATH DEFAULT_PATH_SPLIT_USR #else # define DEFAULT_PATH DEFAULT_PATH_NORMAL diff --git a/src/basic/process-util.c b/src/basic/process-util.c index ab661a8f163..8e94f969c38 100644 --- a/src/basic/process-util.c +++ b/src/basic/process-util.c @@ -34,7 +34,7 @@ #include #include #include -#ifdef HAVE_VALGRIND_VALGRIND_H +#if HAVE_VALGRIND_VALGRIND_H #include #endif @@ -945,7 +945,7 @@ int opinionated_personality(unsigned long *ret) { } void valgrind_summary_hack(void) { -#ifdef HAVE_VALGRIND_VALGRIND_H +#if HAVE_VALGRIND_VALGRIND_H if (getpid_cached() == 1 && RUNNING_ON_VALGRIND) { pid_t pid; pid = raw_clone(SIGCHLD); diff --git a/src/basic/random-util.c b/src/basic/random-util.c index 42f484d6879..146c8f55ed1 100644 --- a/src/basic/random-util.c +++ b/src/basic/random-util.c @@ -26,11 +26,11 @@ #include #include -#ifdef HAVE_SYS_AUXV_H +#if HAVE_SYS_AUXV_H # include #endif -#ifdef USE_SYS_RANDOM_H +#if USE_SYS_RANDOM_H # include #else # include @@ -100,14 +100,14 @@ int acquire_random_bytes(void *p, size_t n, bool high_quality_required) { void initialize_srand(void) { static bool srand_called = false; unsigned x; -#ifdef HAVE_SYS_AUXV_H +#if HAVE_SYS_AUXV_H void *auxv; #endif if (srand_called) return; -#ifdef HAVE_SYS_AUXV_H +#if HAVE_SYS_AUXV_H /* The kernel provides us with 16 bytes of entropy in auxv, so let's * try to make use of that to seed the pseudo-random generator. It's * better than nothing... */ diff --git a/src/basic/selinux-util.c b/src/basic/selinux-util.c index 139e6e21e3e..93bcdb21609 100644 --- a/src/basic/selinux-util.c +++ b/src/basic/selinux-util.c @@ -26,7 +26,7 @@ #include #include -#ifdef HAVE_SELINUX +#if HAVE_SELINUX #include #include #include @@ -40,7 +40,7 @@ #include "time-util.h" #include "util.h" -#ifdef HAVE_SELINUX +#if HAVE_SELINUX DEFINE_TRIVIAL_CLEANUP_FUNC(char*, freecon); DEFINE_TRIVIAL_CLEANUP_FUNC(context_t, context_free); @@ -54,7 +54,7 @@ static struct selabel_handle *label_hnd = NULL; #endif bool mac_selinux_use(void) { -#ifdef HAVE_SELINUX +#if HAVE_SELINUX if (cached_use < 0) cached_use = is_selinux_enabled() > 0; @@ -65,7 +65,7 @@ bool mac_selinux_use(void) { } void mac_selinux_retest(void) { -#ifdef HAVE_SELINUX +#if HAVE_SELINUX cached_use = -1; #endif } @@ -73,7 +73,7 @@ void mac_selinux_retest(void) { int mac_selinux_init(void) { int r = 0; -#ifdef HAVE_SELINUX +#if HAVE_SELINUX usec_t before_timestamp, after_timestamp; struct mallinfo before_mallinfo, after_mallinfo; @@ -110,7 +110,7 @@ int mac_selinux_init(void) { void mac_selinux_finish(void) { -#ifdef HAVE_SELINUX +#if HAVE_SELINUX if (!label_hnd) return; @@ -121,7 +121,7 @@ void mac_selinux_finish(void) { int mac_selinux_fix(const char *path, bool ignore_enoent, bool ignore_erofs) { -#ifdef HAVE_SELINUX +#if HAVE_SELINUX struct stat st; int r; @@ -169,7 +169,7 @@ int mac_selinux_fix(const char *path, bool ignore_enoent, bool ignore_erofs) { int mac_selinux_apply(const char *path, const char *label) { -#ifdef HAVE_SELINUX +#if HAVE_SELINUX if (!mac_selinux_use()) return 0; @@ -188,7 +188,7 @@ int mac_selinux_apply(const char *path, const char *label) { int mac_selinux_get_create_label_from_exe(const char *exe, char **label) { int r = -EOPNOTSUPP; -#ifdef HAVE_SELINUX +#if HAVE_SELINUX _cleanup_freecon_ char *mycon = NULL, *fcon = NULL; security_class_t sclass; @@ -220,7 +220,7 @@ int mac_selinux_get_our_label(char **label) { assert(label); -#ifdef HAVE_SELINUX +#if HAVE_SELINUX if (!mac_selinux_use()) return -EOPNOTSUPP; @@ -235,7 +235,7 @@ int mac_selinux_get_our_label(char **label) { int mac_selinux_get_child_mls_label(int socket_fd, const char *exe, const char *exec_label, char **label) { int r = -EOPNOTSUPP; -#ifdef HAVE_SELINUX +#if HAVE_SELINUX _cleanup_freecon_ char *mycon = NULL, *peercon = NULL, *fcon = NULL; _cleanup_context_free_ context_t pcon = NULL, bcon = NULL; security_class_t sclass; @@ -296,7 +296,7 @@ int mac_selinux_get_child_mls_label(int socket_fd, const char *exe, const char * char* mac_selinux_free(char *label) { -#ifdef HAVE_SELINUX +#if HAVE_SELINUX if (!label) return NULL; @@ -312,7 +312,7 @@ char* mac_selinux_free(char *label) { int mac_selinux_create_file_prepare(const char *path, mode_t mode) { -#ifdef HAVE_SELINUX +#if HAVE_SELINUX _cleanup_freecon_ char *filecon = NULL; int r; @@ -355,7 +355,7 @@ int mac_selinux_create_file_prepare(const char *path, mode_t mode) { void mac_selinux_create_file_clear(void) { -#ifdef HAVE_SELINUX +#if HAVE_SELINUX PROTECT_ERRNO; if (!mac_selinux_use()) @@ -367,7 +367,7 @@ void mac_selinux_create_file_clear(void) { int mac_selinux_create_socket_prepare(const char *label) { -#ifdef HAVE_SELINUX +#if HAVE_SELINUX if (!mac_selinux_use()) return 0; @@ -386,7 +386,7 @@ int mac_selinux_create_socket_prepare(const char *label) { void mac_selinux_create_socket_clear(void) { -#ifdef HAVE_SELINUX +#if HAVE_SELINUX PROTECT_ERRNO; if (!mac_selinux_use()) @@ -400,7 +400,7 @@ int mac_selinux_bind(int fd, const struct sockaddr *addr, socklen_t addrlen) { /* Binds a socket and label its file system object according to the SELinux policy */ -#ifdef HAVE_SELINUX +#if HAVE_SELINUX _cleanup_freecon_ char *fcon = NULL; const struct sockaddr_un *un; bool context_changed = false; diff --git a/src/basic/smack-util.c b/src/basic/smack-util.c index 3a3df987df1..e80327c2001 100644 --- a/src/basic/smack-util.c +++ b/src/basic/smack-util.c @@ -35,7 +35,7 @@ #include "string-table.h" #include "xattr-util.h" -#ifdef HAVE_SMACK +#if HAVE_SMACK bool mac_smack_use(void) { static int cached_use = -1; diff --git a/src/basic/socket-util.c b/src/basic/socket-util.c index e8d39674cc5..6af027e02d3 100644 --- a/src/basic/socket-util.c +++ b/src/basic/socket-util.c @@ -48,7 +48,7 @@ #include "utf8.h" #include "util.h" -#ifdef ENABLE_IDN +#if ENABLE_IDN # define IDN_FLAGS (NI_IDN|NI_IDN_USE_STD3_ASCII_RULES) #else # define IDN_FLAGS 0 diff --git a/src/boot/efi/boot.c b/src/boot/efi/boot.c index 21898837e0e..12176f1fe0c 100644 --- a/src/boot/efi/boot.c +++ b/src/boot/efi/boot.c @@ -1650,7 +1650,7 @@ static EFI_STATUS image_start(EFI_HANDLE parent_image, const Config *config, con loaded_image->LoadOptions = options; loaded_image->LoadOptionsSize = (StrLen(loaded_image->LoadOptions)+1) * sizeof(CHAR16); -#ifdef ENABLE_TPM +#if ENABLE_TPM /* Try to log any options to the TPM, especially to catch manually edited options */ err = tpm_log_event(SD_TPM_PCR, (EFI_PHYSICAL_ADDRESS) loaded_image->LoadOptions, diff --git a/src/boot/efi/measure.c b/src/boot/efi/measure.c index 8627c090770..324d1c8b9e0 100644 --- a/src/boot/efi/measure.c +++ b/src/boot/efi/measure.c @@ -11,7 +11,7 @@ * */ -#ifdef ENABLE_TPM +#if ENABLE_TPM #include #include diff --git a/src/boot/efi/meson.build b/src/boot/efi/meson.build index b111aad8521..eb0be02977c 100644 --- a/src/boot/efi/meson.build +++ b/src/boot/efi/meson.build @@ -30,7 +30,7 @@ stub_sources = ''' stub.c '''.split() -if conf.get('ENABLE_EFI', false) and get_option('gnu-efi') != 'false' +if conf.get('ENABLE_EFI') == 1 and get_option('gnu-efi') != 'false' efi_cc = get_option('efi-cc') efi_ld = get_option('efi-ld') @@ -64,7 +64,7 @@ if have_gnu_efi efi_conf = configuration_data() efi_conf.set_quoted('PACKAGE_VERSION', meson.project_version()) efi_conf.set_quoted('EFI_MACHINE_TYPE_NAME', EFI_MACHINE_TYPE_NAME) - efi_conf.set('ENABLE_TPM', get_option('tpm')) + efi_conf.set10('ENABLE_TPM', get_option('tpm')) efi_conf.set('SD_TPM_PCR', get_option('tpm-pcrindex')) efi_config_h = configure_file( diff --git a/src/boot/efi/stub.c b/src/boot/efi/stub.c index 7d03370cbd2..e85ebf2c3f2 100644 --- a/src/boot/efi/stub.c +++ b/src/boot/efi/stub.c @@ -87,7 +87,7 @@ EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) { line[i] = options[i]; cmdline = line; -#ifdef ENABLE_TPM +#if ENABLE_TPM /* Try to log any options to the TPM, especially manually edited options */ err = tpm_log_event(SD_TPM_PCR, (EFI_PHYSICAL_ADDRESS) loaded_image->LoadOptions, diff --git a/src/core/audit-fd.c b/src/core/audit-fd.c index bc421a43430..6207f8185e7 100644 --- a/src/core/audit-fd.c +++ b/src/core/audit-fd.c @@ -22,7 +22,7 @@ #include "audit-fd.h" -#ifdef HAVE_AUDIT +#if HAVE_AUDIT #include #include diff --git a/src/core/dbus-execute.c b/src/core/dbus-execute.c index 1a388f55921..e0aa9fdd825 100644 --- a/src/core/dbus-execute.c +++ b/src/core/dbus-execute.c @@ -19,7 +19,7 @@ #include -#ifdef HAVE_SECCOMP +#if HAVE_SECCOMP #include #endif @@ -42,7 +42,7 @@ #include "path-util.h" #include "process-util.h" #include "rlimit-util.h" -#ifdef HAVE_SECCOMP +#if HAVE_SECCOMP #include "seccomp-util.h" #endif #include "securebits-util.h" @@ -376,7 +376,7 @@ static int property_get_syscall_filter( _cleanup_strv_free_ char **l = NULL; int r; -#ifdef HAVE_SECCOMP +#if HAVE_SECCOMP Iterator i; void *id; #endif @@ -393,7 +393,7 @@ static int property_get_syscall_filter( if (r < 0) return r; -#ifdef HAVE_SECCOMP +#if HAVE_SECCOMP SET_FOREACH(id, c->syscall_filter, i) { char *name; @@ -429,7 +429,7 @@ static int property_get_syscall_archs( _cleanup_strv_free_ char **l = NULL; int r; -#ifdef HAVE_SECCOMP +#if HAVE_SECCOMP Iterator i; void *id; #endif @@ -438,7 +438,7 @@ static int property_get_syscall_archs( assert(reply); assert(c); -#ifdef HAVE_SECCOMP +#if HAVE_SECCOMP SET_FOREACH(id, c->syscall_archs, i) { const char *name; @@ -1185,7 +1185,7 @@ int bus_exec_context_set_transient_property( return 1; -#ifdef HAVE_SECCOMP +#if HAVE_SECCOMP } else if (streq(name, "SystemCallFilter")) { int whitelist; diff --git a/src/core/dbus.c b/src/core/dbus.c index 6d3f7141924..210b344cd3d 100644 --- a/src/core/dbus.c +++ b/src/core/dbus.c @@ -211,7 +211,7 @@ failed: return 0; } -#ifdef HAVE_SELINUX +#if HAVE_SELINUX static int mac_selinux_filter(sd_bus_message *message, void *userdata, sd_bus_error *error) { Manager *m = userdata; const char *verb, *path; @@ -535,7 +535,7 @@ static int bus_setup_api_vtables(Manager *m, sd_bus *bus) { assert(m); assert(bus); -#ifdef HAVE_SELINUX +#if HAVE_SELINUX r = sd_bus_add_filter(bus, NULL, mac_selinux_filter, m); if (r < 0) return log_error_errno(r, "Failed to add SELinux access filter: %m"); diff --git a/src/core/execute.c b/src/core/execute.c index e1c2a57cc62..2271a2876a2 100644 --- a/src/core/execute.c +++ b/src/core/execute.c @@ -37,19 +37,19 @@ #include #include -#ifdef HAVE_PAM +#if HAVE_PAM #include #endif -#ifdef HAVE_SELINUX +#if HAVE_SELINUX #include #endif -#ifdef HAVE_SECCOMP +#if HAVE_SECCOMP #include #endif -#ifdef HAVE_APPARMOR +#if HAVE_APPARMOR #include #endif @@ -57,7 +57,7 @@ #include "af-list.h" #include "alloc-util.h" -#ifdef HAVE_APPARMOR +#if HAVE_APPARMOR #include "apparmor-util.h" #endif #include "async.h" @@ -88,7 +88,7 @@ #include "process-util.h" #include "rlimit-util.h" #include "rm-rf.h" -#ifdef HAVE_SECCOMP +#if HAVE_SECCOMP #include "seccomp-util.h" #endif #include "securebits.h" @@ -1019,7 +1019,7 @@ static int enforce_user(const ExecContext *context, uid_t uid) { return 0; } -#ifdef HAVE_PAM +#if HAVE_PAM static int null_conv( int num_msg, @@ -1043,7 +1043,7 @@ static int setup_pam( char ***env, int fds[], unsigned n_fds) { -#ifdef HAVE_PAM +#if HAVE_PAM static const struct pam_conv conv = { .conv = null_conv, @@ -1318,7 +1318,7 @@ static bool context_has_no_new_privileges(const ExecContext *c) { c->lock_personality; } -#ifdef HAVE_SECCOMP +#if HAVE_SECCOMP static bool skip_seccomp_unavailable(const Unit* u, const char* msg) { @@ -2688,13 +2688,13 @@ static int exec_child( needs_setuid, /* Do we need to do the actual setresuid()/setresgid() calls? */ needs_mount_namespace, /* Do we need to set up a mount namespace for this kernel? */ needs_ambient_hack; /* Do we need to apply the ambient capabilities hack? */ -#ifdef HAVE_SELINUX +#if HAVE_SELINUX bool use_selinux = false; #endif -#ifdef HAVE_SMACK +#if HAVE_SMACK bool use_smack = false; #endif -#ifdef HAVE_APPARMOR +#if HAVE_APPARMOR bool use_apparmor = false; #endif uid_t uid = UID_INVALID; @@ -3048,13 +3048,13 @@ static int exec_child( * present. The actual MAC context application will happen later, as late as possible, to avoid * impacting our own code paths. */ -#ifdef HAVE_SELINUX +#if HAVE_SELINUX use_selinux = mac_selinux_use(); #endif -#ifdef HAVE_SMACK +#if HAVE_SMACK use_smack = mac_smack_use(); #endif -#ifdef HAVE_APPARMOR +#if HAVE_APPARMOR use_apparmor = mac_apparmor_use(); #endif } @@ -3101,7 +3101,7 @@ static int exec_child( } if (needs_sandboxing) { -#ifdef HAVE_SELINUX +#if HAVE_SELINUX if (use_selinux && params->selinux_context_net && socket_fd >= 0) { r = mac_selinux_get_child_mls_label(socket_fd, command->path, context->selinux_context, &mac_selinux_context_net); if (r < 0) { @@ -3223,7 +3223,7 @@ static int exec_child( * syscalls that are subject to seccomp filtering, hence should probably be applied before the syscalls * are restricted. */ -#ifdef HAVE_SELINUX +#if HAVE_SELINUX if (use_selinux) { char *exec_context = mac_selinux_context_net ?: context->selinux_context; @@ -3237,7 +3237,7 @@ static int exec_child( } #endif -#ifdef HAVE_SMACK +#if HAVE_SMACK if (use_smack) { r = setup_smack(context, command); if (r < 0) { @@ -3247,7 +3247,7 @@ static int exec_child( } #endif -#ifdef HAVE_APPARMOR +#if HAVE_APPARMOR if (use_apparmor && context->apparmor_profile) { r = aa_change_onexec(context->apparmor_profile); if (r < 0 && !context->apparmor_profile_ignore) { @@ -3271,7 +3271,7 @@ static int exec_child( return log_unit_error_errno(unit, errno, "Failed to disable new privileges: %m"); } -#ifdef HAVE_SECCOMP +#if HAVE_SECCOMP r = apply_address_families(unit, context); if (r < 0) { *exit_status = EXIT_ADDRESS_FAMILIES; @@ -4118,7 +4118,7 @@ void exec_context_dump(ExecContext *c, FILE* f, const char *prefix) { prefix, yes_no(c->lock_personality)); if (c->syscall_filter) { -#ifdef HAVE_SECCOMP +#if HAVE_SECCOMP Iterator j; void *id; bool first = true; @@ -4131,7 +4131,7 @@ void exec_context_dump(ExecContext *c, FILE* f, const char *prefix) { if (!c->syscall_whitelist) fputc('~', f); -#ifdef HAVE_SECCOMP +#if HAVE_SECCOMP SET_FOREACH(id, c->syscall_filter, j) { _cleanup_free_ char *name = NULL; @@ -4149,7 +4149,7 @@ void exec_context_dump(ExecContext *c, FILE* f, const char *prefix) { } if (c->syscall_archs) { -#ifdef HAVE_SECCOMP +#if HAVE_SECCOMP Iterator j; void *id; #endif @@ -4158,7 +4158,7 @@ void exec_context_dump(ExecContext *c, FILE* f, const char *prefix) { "%sSystemCallArchitectures:", prefix); -#ifdef HAVE_SECCOMP +#if HAVE_SECCOMP SET_FOREACH(id, c->syscall_archs, j) fprintf(f, " %s", strna(seccomp_arch_to_string(PTR_TO_UINT32(id) - 1))); #endif diff --git a/src/core/ima-setup.c b/src/core/ima-setup.c index 7b5c98a57c9..1aaae9f49ea 100644 --- a/src/core/ima-setup.c +++ b/src/core/ima-setup.c @@ -33,7 +33,7 @@ #define IMA_POLICY_PATH "/etc/ima/ima-policy" int ima_setup(void) { -#ifdef HAVE_IMA +#if HAVE_IMA _cleanup_fclose_ FILE *input = NULL; _cleanup_close_ int imafd = -1; unsigned lineno = 0; diff --git a/src/core/kmod-setup.c b/src/core/kmod-setup.c index 30b42fffe5b..066b959770e 100644 --- a/src/core/kmod-setup.c +++ b/src/core/kmod-setup.c @@ -21,7 +21,7 @@ #include #include -#ifdef HAVE_KMOD +#if HAVE_KMOD #include #endif @@ -33,7 +33,7 @@ #include "macro.h" #include "string-util.h" -#ifdef HAVE_KMOD +#if HAVE_KMOD static void systemd_kmod_log( void *data, int priority, @@ -85,7 +85,7 @@ static bool has_virtio_rng(void) { #endif int kmod_setup(void) { -#ifdef HAVE_KMOD +#if HAVE_KMOD static const struct { const char *module; @@ -103,7 +103,7 @@ int kmod_setup(void) { /* this should never be a module */ { "unix", "/proc/net/unix", true, true, NULL }, -#ifdef HAVE_LIBIPTC +#if HAVE_LIBIPTC /* netfilter is needed by networkd, nspawn among others, and cannot be autoloaded */ { "ip_tables", "/proc/net/ip_tables_names", false, false, NULL }, #endif diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c index 2c3783a9f0d..04170695c5d 100644 --- a/src/core/load-fragment.c +++ b/src/core/load-fragment.c @@ -22,7 +22,7 @@ #include #include #include -#ifdef HAVE_SECCOMP +#if HAVE_SECCOMP #include #endif #include @@ -54,7 +54,7 @@ #include "path-util.h" #include "process-util.h" #include "rlimit-util.h" -#ifdef HAVE_SECCOMP +#if HAVE_SECCOMP #include "seccomp-util.h" #endif #include "securebits.h" @@ -1246,7 +1246,7 @@ int config_parse_limit( return 0; } -#ifdef HAVE_SYSV_COMPAT +#if HAVE_SYSV_COMPAT int config_parse_sysv_priority(const char *unit, const char *filename, unsigned line, @@ -2643,7 +2643,7 @@ int config_parse_documentation(const char *unit, return r; } -#ifdef HAVE_SECCOMP +#if HAVE_SECCOMP static int syscall_filter_parse_one( const char *unit, @@ -4504,7 +4504,7 @@ void unit_dump_config_items(FILE *f) { const ConfigParserCallback callback; const char *rvalue; } table[] = { -#if !defined(HAVE_SYSV_COMPAT) || !defined(HAVE_SECCOMP) || !defined(HAVE_PAM) || !defined(HAVE_SELINUX) || !defined(HAVE_SMACK) || !defined(HAVE_APPARMOR) +#if !HAVE_SYSV_COMPAT || !HAVE_SECCOMP || !HAVE_PAM || !HAVE_SELINUX || !HAVE_SMACK || !HAVE_APPARMOR { config_parse_warn_compat, "NOTSUPPORTED" }, #endif { config_parse_int, "INTEGER" }, @@ -4537,7 +4537,7 @@ void unit_dump_config_items(FILE *f) { { config_parse_exec, "PATH [ARGUMENT [...]]" }, { config_parse_service_type, "SERVICETYPE" }, { config_parse_service_restart, "SERVICERESTART" }, -#ifdef HAVE_SYSV_COMPAT +#if HAVE_SYSV_COMPAT { config_parse_sysv_priority, "SYSVPRIORITY" }, #endif { config_parse_kill_mode, "KILLMODE" }, @@ -4567,7 +4567,7 @@ void unit_dump_config_items(FILE *f) { { config_parse_set_status, "STATUS" }, { config_parse_service_sockets, "SOCKETS" }, { config_parse_environ, "ENVIRON" }, -#ifdef HAVE_SECCOMP +#if HAVE_SECCOMP { config_parse_syscall_filter, "SYSCALLS" }, { config_parse_syscall_archs, "ARCHS" }, { config_parse_syscall_errno, "ERRNO" }, @@ -4587,7 +4587,7 @@ void unit_dump_config_items(FILE *f) { { config_parse_blockio_device_weight, "DEVICEWEIGHT" }, { config_parse_long, "LONG" }, { config_parse_socket_service, "SERVICE" }, -#ifdef HAVE_SELINUX +#if HAVE_SELINUX { config_parse_exec_selinux_context, "LABEL" }, #endif { config_parse_job_mode, "MODE" }, diff --git a/src/core/main.c b/src/core/main.c index 2dfd48005b7..60863d2eed1 100644 --- a/src/core/main.c +++ b/src/core/main.c @@ -28,10 +28,10 @@ #include #include #include -#ifdef HAVE_SECCOMP +#if HAVE_SECCOMP #include #endif -#ifdef HAVE_VALGRIND_VALGRIND_H +#if HAVE_VALGRIND_VALGRIND_H #include #endif @@ -74,7 +74,7 @@ #include "process-util.h" #include "raw-clone.h" #include "rlimit-util.h" -#ifdef HAVE_SECCOMP +#if HAVE_SECCOMP #include "seccomp-util.h" #endif #include "selinux-setup.h" @@ -717,7 +717,7 @@ static int parse_config_file(void) { { "Manager", "RuntimeWatchdogSec", config_parse_sec, 0, &arg_runtime_watchdog }, { "Manager", "ShutdownWatchdogSec", config_parse_sec, 0, &arg_shutdown_watchdog }, { "Manager", "CapabilityBoundingSet", config_parse_capability_set, 0, &arg_capability_bounding_set }, -#ifdef HAVE_SECCOMP +#if HAVE_SECCOMP { "Manager", "SystemCallArchitectures", config_parse_syscall_archs, 0, &arg_syscall_archs }, #endif { "Manager", "TimerSlackNSec", config_parse_nsec, 0, &arg_timer_slack_nsec }, @@ -1264,7 +1264,7 @@ oom: } static int enforce_syscall_archs(Set *archs) { -#ifdef HAVE_SECCOMP +#if HAVE_SECCOMP int r; if (!is_seccomp_available()) @@ -1411,7 +1411,7 @@ int main(int argc, char *argv[]) { struct rlimit saved_rlimit_nofile = RLIMIT_MAKE_CONST(0), saved_rlimit_memlock = RLIMIT_MAKE_CONST((rlim_t) -1); const char *error_message = NULL; -#ifdef HAVE_SYSV_COMPAT +#if HAVE_SYSV_COMPAT if (getpid_cached() != 1 && strstr(program_invocation_short_name, "init")) { /* This is compatibility support for SysV, where * calling init as a user is identical to telinit. */ @@ -2172,7 +2172,7 @@ finish: arg_serialization = safe_fclose(arg_serialization); fds = fdset_free(fds); -#ifdef HAVE_VALGRIND_VALGRIND_H +#if HAVE_VALGRIND_VALGRIND_H /* If we are PID 1 and running under valgrind, then let's exit * here explicitly. valgrind will only generate nice output on * exit(), not on exec(), hence let's do the former not the diff --git a/src/core/manager.c b/src/core/manager.c index 5c127e08484..a0d3c85ff18 100644 --- a/src/core/manager.c +++ b/src/core/manager.c @@ -30,7 +30,7 @@ #include #include -#ifdef HAVE_AUDIT +#if HAVE_AUDIT #include #endif @@ -620,7 +620,7 @@ int manager_new(UnitFileScope scope, unsigned test_run_flags, Manager **_m) { m->default_timeout_stop_usec = DEFAULT_TIMEOUT_USEC; m->default_restart_usec = DEFAULT_RESTART_USEC; -#ifdef ENABLE_EFI +#if ENABLE_EFI if (MANAGER_IS_SYSTEM(m) && detect_container() <= 0) boot_timestamps(&m->userspace_timestamp, &m->firmware_timestamp, &m->loader_timestamp); #endif @@ -2457,7 +2457,7 @@ int manager_get_job_from_dbus_path(Manager *m, const char *s, Job **_j) { void manager_send_unit_audit(Manager *m, Unit *u, int type, bool success) { -#ifdef HAVE_AUDIT +#if HAVE_AUDIT _cleanup_free_ char *p = NULL; const char *msg; int audit_fd, r; diff --git a/src/core/mount-setup.c b/src/core/mount-setup.c index b343bb7e099..676c82dcc9a 100644 --- a/src/core/mount-setup.c +++ b/src/core/mount-setup.c @@ -64,7 +64,7 @@ typedef struct MountPoint { * fourth (securityfs) is needed by IMA to load a custom policy. The * other ones we can delay until SELinux and IMA are loaded. When * SMACK is enabled we need smackfs, too, so it's a fifth one. */ -#ifdef HAVE_SMACK +#if HAVE_SMACK #define N_EARLY_MOUNT 5 #else #define N_EARLY_MOUNT 4 @@ -79,7 +79,7 @@ static const MountPoint mount_table[] = { NULL, MNT_FATAL|MNT_IN_CONTAINER }, { "securityfs", "/sys/kernel/security", "securityfs", NULL, MS_NOSUID|MS_NOEXEC|MS_NODEV, NULL, MNT_NONE }, -#ifdef HAVE_SMACK +#if HAVE_SMACK { "smackfs", "/sys/fs/smackfs", "smackfs", "smackfsdef=*", MS_NOSUID|MS_NOEXEC|MS_NODEV, mac_smack_use, MNT_FATAL }, { "tmpfs", "/dev/shm", "tmpfs", "mode=1777,smackfsroot=*", MS_NOSUID|MS_NODEV|MS_STRICTATIME, @@ -89,7 +89,7 @@ static const MountPoint mount_table[] = { NULL, MNT_FATAL|MNT_IN_CONTAINER }, { "devpts", "/dev/pts", "devpts", "mode=620,gid=" STRINGIFY(TTY_GID), MS_NOSUID|MS_NOEXEC, NULL, MNT_IN_CONTAINER }, -#ifdef HAVE_SMACK +#if HAVE_SMACK { "tmpfs", "/run", "tmpfs", "mode=755,smackfsroot=*", MS_NOSUID|MS_NODEV|MS_STRICTATIME, mac_smack_use, MNT_FATAL }, #endif @@ -111,7 +111,7 @@ static const MountPoint mount_table[] = { cg_is_legacy_wanted, MNT_FATAL|MNT_IN_CONTAINER }, { "pstore", "/sys/fs/pstore", "pstore", NULL, MS_NOSUID|MS_NOEXEC|MS_NODEV, NULL, MNT_NONE }, -#ifdef ENABLE_EFI +#if ENABLE_EFI { "efivarfs", "/sys/firmware/efi/efivars", "efivarfs", NULL, MS_NOSUID|MS_NOEXEC|MS_NODEV, is_efi_boot, MNT_NONE }, #endif @@ -336,7 +336,7 @@ int mount_cgroup_controllers(char ***join_controllers) { return 0; } -#if defined(HAVE_SELINUX) || defined(HAVE_SMACK) +#if HAVE_SELINUX || HAVE_SMACK static int nftw_cb( const char *fpath, const struct stat *sb, @@ -367,7 +367,7 @@ int mount_setup(bool loaded_policy) { if (r < 0) return r; -#if defined(HAVE_SELINUX) || defined(HAVE_SMACK) +#if HAVE_SELINUX || HAVE_SMACK /* Nodes in devtmpfs and /run need to be manually updated for * the appropriate labels, after mounting. The other virtual * API file systems like /sys and /proc do not need that, they diff --git a/src/core/namespace.c b/src/core/namespace.c index 932fbe5c54c..6d74b8da674 100644 --- a/src/core/namespace.c +++ b/src/core/namespace.c @@ -107,7 +107,7 @@ static const MountEntry protect_kernel_tunables_table[] = { /* ProtectKernelModules= option */ static const MountEntry protect_kernel_modules_table[] = { -#ifdef HAVE_SPLIT_USR +#if HAVE_SPLIT_USR { "/lib/modules", INACCESSIBLE, true }, #endif { "/usr/lib/modules", INACCESSIBLE, true }, diff --git a/src/core/selinux-access.c b/src/core/selinux-access.c index 0f8a2d68e29..2db41894015 100644 --- a/src/core/selinux-access.c +++ b/src/core/selinux-access.c @@ -19,13 +19,13 @@ #include "selinux-access.h" -#ifdef HAVE_SELINUX +#if HAVE_SELINUX #include #include #include #include -#ifdef HAVE_AUDIT +#if HAVE_AUDIT #include #endif @@ -112,7 +112,7 @@ _printf_(2, 3) static int log_callback(int type, const char *fmt, ...) { va_list ap; const char *fmt2; -#ifdef HAVE_AUDIT +#if HAVE_AUDIT int fd; fd = get_audit_fd(); diff --git a/src/core/selinux-access.h b/src/core/selinux-access.h index f46370d0204..1f6a518a61b 100644 --- a/src/core/selinux-access.h +++ b/src/core/selinux-access.h @@ -26,7 +26,7 @@ int mac_selinux_generic_access_check(sd_bus_message *message, const char *path, const char *permission, sd_bus_error *error); -#ifdef HAVE_SELINUX +#if HAVE_SELINUX #define mac_selinux_access_check(message, permission, error) \ mac_selinux_generic_access_check((message), NULL, (permission), (error)) diff --git a/src/core/selinux-setup.c b/src/core/selinux-setup.c index 527aa8add0f..60361a56385 100644 --- a/src/core/selinux-setup.c +++ b/src/core/selinux-setup.c @@ -21,7 +21,7 @@ #include #include -#ifdef HAVE_SELINUX +#if HAVE_SELINUX #include #endif @@ -32,7 +32,7 @@ #include "string-util.h" #include "util.h" -#ifdef HAVE_SELINUX +#if HAVE_SELINUX _printf_(2,3) static int null_log(int type, const char *fmt, ...) { return 0; @@ -41,7 +41,7 @@ static int null_log(int type, const char *fmt, ...) { int mac_selinux_setup(bool *loaded_policy) { -#ifdef HAVE_SELINUX +#if HAVE_SELINUX int enforce = 0; usec_t before_load, after_load; char *con; diff --git a/src/core/smack-setup.c b/src/core/smack-setup.c index 9f253643351..be32c434235 100644 --- a/src/core/smack-setup.c +++ b/src/core/smack-setup.c @@ -36,7 +36,7 @@ #include "string-util.h" #include "util.h" -#ifdef HAVE_SMACK +#if HAVE_SMACK static int write_access2_rules(const char* srcdir) { _cleanup_close_ int load2_fd = -1, change_fd = -1; @@ -316,7 +316,7 @@ static int write_onlycap_list(void) { int mac_smack_setup(bool *loaded_policy) { -#ifdef HAVE_SMACK +#if HAVE_SMACK int r; diff --git a/src/core/umount.c b/src/core/umount.c index 7e9ea203881..813d2571392 100644 --- a/src/core/umount.c +++ b/src/core/umount.c @@ -375,7 +375,7 @@ static int delete_dm(dev_t devnum) { static bool nonunmountable_path(const char *path) { return path_equal(path, "/") -#ifndef HAVE_SPLIT_USR +#if ! HAVE_SPLIT_USR || path_equal(path, "/usr") #endif || path_startswith(path, "/run/initramfs"); diff --git a/src/coredump/coredump.c b/src/coredump/coredump.c index 96a4d400f89..300d6479039 100644 --- a/src/coredump/coredump.c +++ b/src/coredump/coredump.c @@ -23,7 +23,7 @@ #include #include -#ifdef HAVE_ELFUTILS +#if HAVE_ELFUTILS #include #include #endif @@ -156,7 +156,7 @@ static inline uint64_t storage_size_max(void) { static int fix_acl(int fd, uid_t uid) { -#ifdef HAVE_ACL +#if HAVE_ACL _cleanup_(acl_freep) acl_t acl = NULL; acl_entry_t entry; acl_permset_t permset; @@ -393,7 +393,7 @@ static int save_external_coredump( goto fail; } -#if defined(HAVE_XZ) || defined(HAVE_LZ4) +#if HAVE_XZ || HAVE_LZ4 /* If we will remove the coredump anyway, do not compress. */ if (arg_compress && !maybe_remove_external_coredump(NULL, st.st_size)) { @@ -765,7 +765,7 @@ static int submit_coredump( if (r < 0) return log_error_errno(r, "Failed to drop privileges: %m"); -#ifdef HAVE_ELFUTILS +#if HAVE_ELFUTILS /* Try to get a strack trace if we can */ if (coredump_size <= arg_process_size_max) { _cleanup_free_ char *stacktrace = NULL; diff --git a/src/coredump/coredumpctl.c b/src/coredump/coredumpctl.c index 114a13fc78c..0380df10d1b 100644 --- a/src/coredump/coredumpctl.c +++ b/src/coredump/coredumpctl.c @@ -799,7 +799,7 @@ static int save_core(sd_journal *j, FILE *file, char **path, bool *unlink_temp) } if (filename) { -#if defined(HAVE_XZ) || defined(HAVE_LZ4) +#if HAVE_XZ || HAVE_LZ4 _cleanup_close_ int fdf; fdf = open(filename, O_RDONLY | O_CLOEXEC); diff --git a/src/coredump/meson.build b/src/coredump/meson.build index 8f7d898b624..25a04090467 100644 --- a/src/coredump/meson.build +++ b/src/coredump/meson.build @@ -4,7 +4,7 @@ systemd_coredump_sources = files(''' coredump-vacuum.h '''.split()) -if conf.get('HAVE_ELFUTILS', false) +if conf.get('HAVE_ELFUTILS') == 1 systemd_coredump_sources += files(['stacktrace.c', 'stacktrace.h']) endif diff --git a/src/delta/delta.c b/src/delta/delta.c index b0689ffff77..605bea57bbe 100644 --- a/src/delta/delta.c +++ b/src/delta/delta.c @@ -49,7 +49,7 @@ static const char prefixes[] = "/usr/local/share\0" "/usr/lib\0" "/usr/share\0" -#ifdef HAVE_SPLIT_USR +#if HAVE_SPLIT_USR "/lib\0" #endif ; @@ -392,7 +392,7 @@ static int enumerate_dir( } static int should_skip_prefix(const char* p) { -#ifdef HAVE_SPLIT_USR +#if HAVE_SPLIT_USR int r; _cleanup_free_ char *target = NULL; diff --git a/src/fsck/fsck.c b/src/fsck/fsck.c index 434321f806a..cd39161f10f 100644 --- a/src/fsck/fsck.c +++ b/src/fsck/fsck.c @@ -131,7 +131,7 @@ static int parse_proc_cmdline_item(const char *key, const char *value, void *dat } } -#ifdef HAVE_SYSV_COMPAT +#if HAVE_SYSV_COMPAT else if (streq(key, "fastboot") && !value) { log_warning("Please pass 'fsck.mode=skip' rather than 'fastboot' on the kernel command line."); arg_skip = true; @@ -147,7 +147,7 @@ static int parse_proc_cmdline_item(const char *key, const char *value, void *dat static void test_files(void) { -#ifdef HAVE_SYSV_COMPAT +#if HAVE_SYSV_COMPAT if (access("/fastboot", F_OK) >= 0) { log_error("Please pass 'fsck.mode=skip' on the kernel command line rather than creating /fastboot on the root file system."); arg_skip = true; diff --git a/src/gpt-auto-generator/gpt-auto-generator.c b/src/gpt-auto-generator/gpt-auto-generator.c index bf28af0a6f9..ae0a8da63a9 100644 --- a/src/gpt-auto-generator/gpt-auto-generator.c +++ b/src/gpt-auto-generator/gpt-auto-generator.c @@ -323,7 +323,7 @@ static int add_swap(const char *path) { return generator_add_symlink(arg_dest, SPECIAL_SWAP_TARGET, "wants", name); } -#ifdef ENABLE_EFI +#if ENABLE_EFI static int add_automount( const char *id, const char *what, @@ -612,7 +612,7 @@ static int parse_proc_cmdline_item(const char *key, const char *value, void *dat return 0; } -#ifdef ENABLE_EFI +#if ENABLE_EFI static int add_root_cryptsetup(void) { /* If a device /dev/gpt-auto-root-luks appears, then make it pull in systemd-cryptsetup-root.service, which @@ -624,7 +624,7 @@ static int add_root_cryptsetup(void) { static int add_root_mount(void) { -#ifdef ENABLE_EFI +#if ENABLE_EFI int r; if (!is_efi_boot()) { diff --git a/src/hostname/meson.build b/src/hostname/meson.build index d58caa67877..834300ae6e1 100644 --- a/src/hostname/meson.build +++ b/src/hostname/meson.build @@ -1,4 +1,4 @@ -if conf.get('ENABLE_HOSTNAMED', false) +if conf.get('ENABLE_HOSTNAMED') == 1 install_data('org.freedesktop.hostname1.conf', install_dir : dbuspolicydir) install_data('org.freedesktop.hostname1.service', diff --git a/src/import/meson.build b/src/import/meson.build index 3fd58cc2c8f..e3a0da65d21 100644 --- a/src/import/meson.build +++ b/src/import/meson.build @@ -48,7 +48,7 @@ systemd_export_sources = files(''' import-compress.h '''.split()) -if conf.get('ENABLE_IMPORTD', false) +if conf.get('ENABLE_IMPORTD') == 1 install_data('org.freedesktop.import1.conf', install_dir : dbuspolicydir) install_data('org.freedesktop.import1.service', diff --git a/src/journal-remote/journal-gatewayd.c b/src/journal-remote/journal-gatewayd.c index 63261bfa6c5..a0f1f3e926b 100644 --- a/src/journal-remote/journal-gatewayd.c +++ b/src/journal-remote/journal-gatewayd.c @@ -946,7 +946,7 @@ static int parse_argv(int argc, char *argv[]) { break; case ARG_TRUST: -#ifdef HAVE_GNUTLS +#if HAVE_GNUTLS if (arg_trust_pem) { log_error("CA certificate file specified twice"); return -EINVAL; diff --git a/src/journal-remote/journal-remote.c b/src/journal-remote/journal-remote.c index 64b1105901a..9f51137645b 100644 --- a/src/journal-remote/journal-remote.c +++ b/src/journal-remote/journal-remote.c @@ -1384,7 +1384,7 @@ static int parse_argv(int argc, char *argv[]) { if (streq(optarg, "all")) arg_trust_all = true; else { -#ifdef HAVE_GNUTLS +#if HAVE_GNUTLS arg_trust = strdup(optarg); if (!arg_trust) return log_oom(); @@ -1442,7 +1442,7 @@ static int parse_argv(int argc, char *argv[]) { break; case ARG_GNUTLS_LOG: { -#ifdef HAVE_GNUTLS +#if HAVE_GNUTLS const char* p = optarg; for (;;) { _cleanup_free_ char *word = NULL; diff --git a/src/journal-remote/meson.build b/src/journal-remote/meson.build index d266b34e659..ed963d79307 100644 --- a/src/journal-remote/meson.build +++ b/src/journal-remote/meson.build @@ -21,7 +21,7 @@ systemd_journal_gatewayd_sources = files(''' microhttpd-util.c '''.split()) -if conf.get('ENABLE_REMOTE', false) and conf.get('HAVE_LIBCURL', false) +if conf.get('ENABLE_REMOTE') ==1 and conf.get('HAVE_LIBCURL') == 1 journal_upload_conf = configure_file( input : 'journal-upload.conf.in', output : 'journal-upload.conf', @@ -30,7 +30,7 @@ if conf.get('ENABLE_REMOTE', false) and conf.get('HAVE_LIBCURL', false) install_dir : pkgsysconfdir) endif -if conf.get('ENABLE_REMOTE', false) and conf.get('HAVE_MICROHTTPD', false) +if conf.get('ENABLE_REMOTE') == 1 and conf.get('HAVE_MICROHTTPD') == 1 journal_remote_conf = configure_file( input : 'journal-remote.conf.in', output : 'journal-remote.conf', diff --git a/src/journal-remote/microhttpd-util.c b/src/journal-remote/microhttpd-util.c index f5d2d7967ac..75c14ec9967 100644 --- a/src/journal-remote/microhttpd-util.c +++ b/src/journal-remote/microhttpd-util.c @@ -22,7 +22,7 @@ #include #include -#ifdef HAVE_GNUTLS +#if HAVE_GNUTLS #include #include #endif @@ -115,7 +115,7 @@ int mhd_respondf(struct MHD_Connection *connection, return mhd_respond_internal(connection, code, m, r, MHD_RESPMEM_MUST_FREE); } -#ifdef HAVE_GNUTLS +#if HAVE_GNUTLS static struct { const char *const names[4]; diff --git a/src/journal/audit-type.c b/src/journal/audit-type.c index 71e8790ca82..373d3455aeb 100644 --- a/src/journal/audit-type.c +++ b/src/journal/audit-type.c @@ -19,7 +19,7 @@ #include #include -#ifdef HAVE_AUDIT +#if HAVE_AUDIT # include #endif diff --git a/src/journal/compress.c b/src/journal/compress.c index 818a720ba88..3124d1210ea 100644 --- a/src/journal/compress.c +++ b/src/journal/compress.c @@ -23,11 +23,11 @@ #include #include -#ifdef HAVE_XZ +#if HAVE_XZ #include #endif -#ifdef HAVE_LZ4 +#if HAVE_LZ4 #include #include #endif @@ -43,7 +43,7 @@ #include "string-util.h" #include "util.h" -#ifdef HAVE_LZ4 +#if HAVE_LZ4 DEFINE_TRIVIAL_CLEANUP_FUNC(LZ4F_compressionContext_t, LZ4F_freeCompressionContext); DEFINE_TRIVIAL_CLEANUP_FUNC(LZ4F_decompressionContext_t, LZ4F_freeDecompressionContext); #endif @@ -59,7 +59,7 @@ DEFINE_STRING_TABLE_LOOKUP(object_compressed, int); int compress_blob_xz(const void *src, uint64_t src_size, void *dst, size_t dst_alloc_size, size_t *dst_size) { -#ifdef HAVE_XZ +#if HAVE_XZ static const lzma_options_lzma opt = { 1u << 20u, NULL, 0, LZMA_LC_DEFAULT, LZMA_LP_DEFAULT, LZMA_PB_DEFAULT, LZMA_MODE_FAST, 128, LZMA_MF_HC3, 4 @@ -97,7 +97,7 @@ int compress_blob_xz(const void *src, uint64_t src_size, int compress_blob_lz4(const void *src, uint64_t src_size, void *dst, size_t dst_alloc_size, size_t *dst_size) { -#ifdef HAVE_LZ4 +#if HAVE_LZ4 int r; assert(src); @@ -133,7 +133,7 @@ int compress_blob_lz4(const void *src, uint64_t src_size, int decompress_blob_xz(const void *src, uint64_t src_size, void **dst, size_t *dst_alloc_size, size_t* dst_size, size_t dst_max) { -#ifdef HAVE_XZ +#if HAVE_XZ _cleanup_(lzma_end) lzma_stream s = LZMA_STREAM_INIT; lzma_ret ret; size_t space; @@ -193,7 +193,7 @@ int decompress_blob_xz(const void *src, uint64_t src_size, int decompress_blob_lz4(const void *src, uint64_t src_size, void **dst, size_t *dst_alloc_size, size_t* dst_size, size_t dst_max) { -#ifdef HAVE_LZ4 +#if HAVE_LZ4 char* out; int r, size; /* LZ4 uses int for size */ @@ -249,7 +249,7 @@ int decompress_startswith_xz(const void *src, uint64_t src_size, const void *prefix, size_t prefix_len, uint8_t extra) { -#ifdef HAVE_XZ +#if HAVE_XZ _cleanup_(lzma_end) lzma_stream s = LZMA_STREAM_INIT; lzma_ret ret; @@ -307,7 +307,7 @@ int decompress_startswith_lz4(const void *src, uint64_t src_size, void **buffer, size_t *buffer_size, const void *prefix, size_t prefix_len, uint8_t extra) { -#ifdef HAVE_LZ4 +#if HAVE_LZ4 /* Checks whether the decompressed blob starts with the * mentioned prefix. The byte extra needs to follow the * prefix */ @@ -372,7 +372,7 @@ int decompress_startswith(int compression, } int compress_stream_xz(int fdf, int fdt, uint64_t max_bytes) { -#ifdef HAVE_XZ +#if HAVE_XZ _cleanup_(lzma_end) lzma_stream s = LZMA_STREAM_INIT; lzma_ret ret; uint8_t buf[BUFSIZ], out[BUFSIZ]; @@ -449,7 +449,7 @@ int compress_stream_xz(int fdf, int fdt, uint64_t max_bytes) { int compress_stream_lz4(int fdf, int fdt, uint64_t max_bytes) { -#ifdef HAVE_LZ4 +#if HAVE_LZ4 LZ4F_errorCode_t c; _cleanup_(LZ4F_freeCompressionContextp) LZ4F_compressionContext_t ctx = NULL; _cleanup_free_ char *buf = NULL; @@ -542,7 +542,7 @@ int compress_stream_lz4(int fdf, int fdt, uint64_t max_bytes) { int decompress_stream_xz(int fdf, int fdt, uint64_t max_bytes) { -#ifdef HAVE_XZ +#if HAVE_XZ _cleanup_(lzma_end) lzma_stream s = LZMA_STREAM_INIT; lzma_ret ret; @@ -616,7 +616,7 @@ int decompress_stream_xz(int fdf, int fdt, uint64_t max_bytes) { } int decompress_stream_lz4(int in, int out, uint64_t max_bytes) { -#ifdef HAVE_LZ4 +#if HAVE_LZ4 size_t c; _cleanup_(LZ4F_freeDecompressionContextp) LZ4F_decompressionContext_t ctx = NULL; _cleanup_free_ char *buf = NULL; diff --git a/src/journal/compress.h b/src/journal/compress.h index c138099d9a8..fb71662a993 100644 --- a/src/journal/compress.h +++ b/src/journal/compress.h @@ -34,7 +34,7 @@ int compress_blob_lz4(const void *src, uint64_t src_size, static inline int compress_blob(const void *src, uint64_t src_size, void *dst, size_t dst_alloc_size, size_t *dst_size) { int r; -#ifdef HAVE_LZ4 +#if HAVE_LZ4 r = compress_blob_lz4(src, src_size, dst, dst_alloc_size, dst_size); if (r == 0) return OBJECT_COMPRESSED_LZ4; @@ -74,7 +74,7 @@ int compress_stream_lz4(int fdf, int fdt, uint64_t max_bytes); int decompress_stream_xz(int fdf, int fdt, uint64_t max_size); int decompress_stream_lz4(int fdf, int fdt, uint64_t max_size); -#ifdef HAVE_LZ4 +#if HAVE_LZ4 # define compress_stream compress_stream_lz4 # define COMPRESSED_EXT ".lz4" #else diff --git a/src/journal/journal-def.h b/src/journal/journal-def.h index 67edb439600..1bd5de4c430 100644 --- a/src/journal/journal-def.h +++ b/src/journal/journal-def.h @@ -162,11 +162,11 @@ enum { #define HEADER_INCOMPATIBLE_ANY (HEADER_INCOMPATIBLE_COMPRESSED_XZ|HEADER_INCOMPATIBLE_COMPRESSED_LZ4) -#if defined(HAVE_XZ) && defined(HAVE_LZ4) +#if HAVE_XZ && HAVE_LZ4 # define HEADER_INCOMPATIBLE_SUPPORTED HEADER_INCOMPATIBLE_ANY -#elif defined(HAVE_XZ) +#elif HAVE_XZ # define HEADER_INCOMPATIBLE_SUPPORTED HEADER_INCOMPATIBLE_COMPRESSED_XZ -#elif defined(HAVE_LZ4) +#elif HAVE_LZ4 # define HEADER_INCOMPATIBLE_SUPPORTED HEADER_INCOMPATIBLE_COMPRESSED_LZ4 #else # define HEADER_INCOMPATIBLE_SUPPORTED 0 @@ -177,7 +177,7 @@ enum { }; #define HEADER_COMPATIBLE_ANY HEADER_COMPATIBLE_SEALED -#ifdef HAVE_GCRYPT +#if HAVE_GCRYPT # define HEADER_COMPATIBLE_SUPPORTED HEADER_COMPATIBLE_SEALED #else # define HEADER_COMPATIBLE_SUPPORTED 0 diff --git a/src/journal/journal-file.c b/src/journal/journal-file.c index ec66f4d5a4f..3027801ab13 100644 --- a/src/journal/journal-file.c +++ b/src/journal/journal-file.c @@ -331,7 +331,7 @@ bool journal_file_is_offlining(JournalFile *f) { JournalFile* journal_file_close(JournalFile *f) { assert(f); -#ifdef HAVE_GCRYPT +#if HAVE_GCRYPT /* Write the final tag */ if (f->seal && f->writable) { int r; @@ -378,11 +378,11 @@ JournalFile* journal_file_close(JournalFile *f) { ordered_hashmap_free_free(f->chain_cache); -#if defined(HAVE_XZ) || defined(HAVE_LZ4) +#if HAVE_XZ || HAVE_LZ4 free(f->compress_buffer); #endif -#ifdef HAVE_GCRYPT +#if HAVE_GCRYPT if (f->fss_file) munmap(f->fss_file, PAGE_ALIGN(f->fss_file_size)); else @@ -1401,7 +1401,7 @@ int journal_file_find_data_object_with_hash( goto next; if (o->object.flags & OBJECT_COMPRESSION_MASK) { -#if defined(HAVE_XZ) || defined(HAVE_LZ4) +#if HAVE_XZ || HAVE_LZ4 uint64_t l; size_t rsize = 0; @@ -1513,7 +1513,7 @@ static int journal_file_append_field( if (r < 0) return r; -#ifdef HAVE_GCRYPT +#if HAVE_GCRYPT r = journal_file_hmac_put_object(f, OBJECT_FIELD, o, p); if (r < 0) return r; @@ -1565,7 +1565,7 @@ static int journal_file_append_data( o->data.hash = htole64(hash); -#if defined(HAVE_XZ) || defined(HAVE_LZ4) +#if HAVE_XZ || HAVE_LZ4 if (JOURNAL_FILE_COMPRESS(f) && size >= COMPRESSION_SIZE_THRESHOLD) { size_t rsize = 0; @@ -1590,7 +1590,7 @@ static int journal_file_append_data( if (r < 0) return r; -#ifdef HAVE_GCRYPT +#if HAVE_GCRYPT r = journal_file_hmac_put_object(f, OBJECT_DATA, o, p); if (r < 0) return r; @@ -1704,7 +1704,7 @@ static int link_entry_into_array(JournalFile *f, if (r < 0) return r; -#ifdef HAVE_GCRYPT +#if HAVE_GCRYPT r = journal_file_hmac_put_object(f, OBJECT_ENTRY_ARRAY, o, q); if (r < 0) return r; @@ -1854,7 +1854,7 @@ static int journal_file_append_entry_internal( o->entry.xor_hash = htole64(xor_hash); o->entry.boot_id = f->header->boot_id; -#ifdef HAVE_GCRYPT +#if HAVE_GCRYPT r = journal_file_hmac_put_object(f, OBJECT_ENTRY, o, np); if (r < 0) return r; @@ -1990,7 +1990,7 @@ int journal_file_append_entry(JournalFile *f, const dual_timestamp *ts, const st ts = &_ts; } -#ifdef HAVE_GCRYPT +#if HAVE_GCRYPT r = journal_file_maybe_append_tag(f, ts->realtime); if (r < 0) return r; @@ -3259,12 +3259,12 @@ int journal_file_open( f->flags = flags; f->prot = prot_from_flags(flags); f->writable = (flags & O_ACCMODE) != O_RDONLY; -#if defined(HAVE_LZ4) +#if HAVE_LZ4 f->compress_lz4 = compress; -#elif defined(HAVE_XZ) +#elif HAVE_XZ f->compress_xz = compress; #endif -#ifdef HAVE_GCRYPT +#if HAVE_GCRYPT f->seal = seal; #endif @@ -3335,7 +3335,7 @@ int journal_file_open( fd_setcrtime(f->fd, 0); -#ifdef HAVE_GCRYPT +#if HAVE_GCRYPT /* Try to load the FSPRG state, and if we can't, then * just don't do sealing */ if (f->seal) { @@ -3376,7 +3376,7 @@ int journal_file_open( goto fail; } -#ifdef HAVE_GCRYPT +#if HAVE_GCRYPT if (!newly_created && f->writable) { r = journal_file_fss_load(f); if (r < 0) @@ -3396,7 +3396,7 @@ int journal_file_open( goto fail; } -#ifdef HAVE_GCRYPT +#if HAVE_GCRYPT r = journal_file_hmac_setup(f); if (r < 0) goto fail; @@ -3411,7 +3411,7 @@ int journal_file_open( if (r < 0) goto fail; -#ifdef HAVE_GCRYPT +#if HAVE_GCRYPT r = journal_file_append_first_tag(f); if (r < 0) goto fail; @@ -3622,7 +3622,7 @@ int journal_file_copy_entry(JournalFile *from, JournalFile *to, Object *o, uint6 return -E2BIG; if (o->object.flags & OBJECT_COMPRESSION_MASK) { -#if defined(HAVE_XZ) || defined(HAVE_LZ4) +#if HAVE_XZ || HAVE_LZ4 size_t rsize = 0; r = decompress_blob(o->object.flags & OBJECT_COMPRESSION_MASK, diff --git a/src/journal/journal-file.h b/src/journal/journal-file.h index df457c9a81d..008dba604bb 100644 --- a/src/journal/journal-file.h +++ b/src/journal/journal-file.h @@ -21,7 +21,7 @@ #include -#ifdef HAVE_GCRYPT +#if HAVE_GCRYPT #include #endif @@ -121,12 +121,12 @@ typedef struct JournalFile { pthread_t offline_thread; volatile OfflineState offline_state; -#if defined(HAVE_XZ) || defined(HAVE_LZ4) +#if HAVE_XZ || HAVE_LZ4 void *compress_buffer; size_t compress_buffer_size; #endif -#ifdef HAVE_GCRYPT +#if HAVE_GCRYPT gcry_md_hd_t hmac; bool hmac_running; diff --git a/src/journal/journal-verify.c b/src/journal/journal-verify.c index 0904b758c84..e756f51d0f2 100644 --- a/src/journal/journal-verify.c +++ b/src/journal/journal-verify.c @@ -834,13 +834,13 @@ int journal_file_verify( bool found_last = false; const char *tmp_dir = NULL; -#ifdef HAVE_GCRYPT +#if HAVE_GCRYPT uint64_t last_tag = 0; #endif assert(f); if (key) { -#ifdef HAVE_GCRYPT +#if HAVE_GCRYPT r = journal_file_parse_verification_key(f, key); if (r < 0) { log_error("Failed to parse seed."); @@ -1103,7 +1103,7 @@ int journal_file_verify( goto fail; } -#ifdef HAVE_GCRYPT +#if HAVE_GCRYPT if (f->seal) { uint64_t q, rt; diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c index 3dcfb0e97a9..61814a0cbba 100644 --- a/src/journal/journalctl.c +++ b/src/journal/journalctl.c @@ -105,7 +105,7 @@ static char **arg_file = NULL; static bool arg_file_stdin = false; static int arg_priorities = 0xFF; static char *arg_verify_key = NULL; -#ifdef HAVE_GCRYPT +#if HAVE_GCRYPT static usec_t arg_interval = DEFAULT_FSS_INTERVAL_USEC; static bool arg_force = false; #endif @@ -313,7 +313,7 @@ static void help(void) { " -D --directory=PATH Show journal files from directory\n" " --file=PATH Show journal file\n" " --root=ROOT Operate on files below a root directory\n" -#ifdef HAVE_GCRYPT +#if HAVE_GCRYPT " --interval=TIME Time interval for changing the FSS sealing key\n" " --verify-key=KEY Specify FSS verification key\n" " --force Override of the FSS key pair with --setup-keys\n" @@ -336,7 +336,7 @@ static void help(void) { " --dump-catalog Show entries in the message catalog\n" " --update-catalog Update the message catalog database\n" " --new-id128 Generate a new 128-bit ID\n" -#ifdef HAVE_GCRYPT +#if HAVE_GCRYPT " --setup-keys Generate a new FSS key pair\n" #endif , program_invocation_short_name); @@ -669,7 +669,7 @@ static int parse_argv(int argc, char *argv[]) { arg_action = ACTION_VACUUM; break; -#ifdef HAVE_GCRYPT +#if HAVE_GCRYPT case ARG_FORCE: arg_force = true; break; @@ -1561,7 +1561,7 @@ static int add_syslog_identifier(sd_journal *j) { } static int setup_keys(void) { -#ifdef HAVE_GCRYPT +#if HAVE_GCRYPT size_t mpk_size, seed_size, state_size, i; uint8_t *mpk, *seed, *state; int fd = -1, r; @@ -1727,7 +1727,7 @@ static int setup_keys(void) { } else fprintf(stderr, "\nThe keys have been generated for host " SD_ID128_FORMAT_STR ".\n", SD_ID128_FORMAT_VAL(machine)); -#ifdef HAVE_QRENCODE +#if HAVE_QRENCODE /* If this is not an UTF-8 system don't print any QR codes */ if (is_locale_utf8()) { fputs("\nTo transfer the verification key to your phone please scan the QR code below:\n\n", stderr); @@ -1769,7 +1769,7 @@ static int verify(sd_journal *j) { int k; usec_t first = 0, validated = 0, last = 0; -#ifdef HAVE_GCRYPT +#if HAVE_GCRYPT if (!arg_verify_key && JOURNAL_HEADER_SEALED(f->header)) log_notice("Journal file %s has sealing enabled but verification key has not been passed using --verify-key=.", f->path); #endif diff --git a/src/journal/journald-context.c b/src/journal/journald-context.c index 10e9615f235..eaa7f2544f4 100644 --- a/src/journal/journald-context.c +++ b/src/journal/journald-context.c @@ -17,7 +17,7 @@ along with systemd; If not, see . ***/ -#ifdef HAVE_SELINUX +#if HAVE_SELINUX #include #endif @@ -227,7 +227,7 @@ static int client_context_read_label( free_and_replace(c->label, l); c->label_size = label_size; } -#ifdef HAVE_SELINUX +#if HAVE_SELINUX else { char *con; diff --git a/src/journal/journald-native.c b/src/journal/journald-native.c index 554f91460d4..e359bcf7149 100644 --- a/src/journal/journald-native.c +++ b/src/journal/journald-native.c @@ -521,7 +521,7 @@ int server_open_native_socket(Server*s) { if (r < 0) return log_error_errno(errno, "SO_PASSCRED failed: %m"); -#ifdef HAVE_SELINUX +#if HAVE_SELINUX if (mac_selinux_use()) { r = setsockopt(s->native_fd, SOL_SOCKET, SO_PASSSEC, &one, sizeof(one)); if (r < 0) diff --git a/src/journal/journald-server.c b/src/journal/journald-server.c index de643c91494..db6ca37d798 100644 --- a/src/journal/journald-server.c +++ b/src/journal/journald-server.c @@ -17,7 +17,7 @@ along with systemd; If not, see . ***/ -#ifdef HAVE_SELINUX +#if HAVE_SELINUX #include #endif #include @@ -240,12 +240,12 @@ void server_space_usage_message(Server *s, JournalStorage *storage) { } static void server_add_acls(JournalFile *f, uid_t uid) { -#ifdef HAVE_ACL +#if HAVE_ACL int r; #endif assert(f); -#ifdef HAVE_ACL +#if HAVE_ACL if (uid <= SYSTEM_UID_MAX) return; @@ -1868,7 +1868,7 @@ int server_init(Server *s) { } void server_maybe_append_tags(Server *s) { -#ifdef HAVE_GCRYPT +#if HAVE_GCRYPT JournalFile *f; Iterator i; usec_t n; diff --git a/src/journal/journald-stream.c b/src/journal/journald-stream.c index d0b95ea02cc..54dd096e455 100644 --- a/src/journal/journald-stream.c +++ b/src/journal/journald-stream.c @@ -20,7 +20,7 @@ #include #include -#ifdef HAVE_SELINUX +#if HAVE_SELINUX #include #endif diff --git a/src/journal/journald-syslog.c b/src/journal/journald-syslog.c index 7d040de8939..1fde0271a65 100644 --- a/src/journal/journald-syslog.c +++ b/src/journal/journald-syslog.c @@ -414,7 +414,7 @@ int server_open_syslog_socket(Server *s) { if (r < 0) return log_error_errno(errno, "SO_PASSCRED failed: %m"); -#ifdef HAVE_SELINUX +#if HAVE_SELINUX if (mac_selinux_use()) { r = setsockopt(s->syslog_fd, SOL_SOCKET, SO_PASSSEC, &one, sizeof(one)); if (r < 0) diff --git a/src/journal/journald.c b/src/journal/journald.c index 4dee764fddf..318e0675631 100644 --- a/src/journal/journald.c +++ b/src/journal/journald.c @@ -91,7 +91,7 @@ int main(int argc, char *argv[]) { t = server.oldest_file_usec + server.max_retention_usec - n; } -#ifdef HAVE_GCRYPT +#if HAVE_GCRYPT if (server.system_journal) { usec_t u; diff --git a/src/journal/meson.build b/src/journal/meson.build index b95efc20411..da42fd89d28 100644 --- a/src/journal/meson.build +++ b/src/journal/meson.build @@ -20,7 +20,7 @@ journal_internal_sources = files(''' sd-journal.c '''.split()) -if conf.get('HAVE_GCRYPT', false) +if conf.get('HAVE_GCRYPT') == 1 journal_internal_sources += files(''' journal-authenticate.c journal-authenticate.h @@ -36,7 +36,7 @@ endif audit_type_includes = [config_h, missing_h, 'linux/audit.h'] -if conf.get('HAVE_AUDIT', false) +if conf.get('HAVE_AUDIT') == 1 audit_type_includes += 'libaudit.h' endif @@ -97,7 +97,7 @@ systemd_cat_sources = files('cat.c') journalctl_sources = files('journalctl.c') -if conf.get('HAVE_QRENCODE', false) +if conf.get('HAVE_QRENCODE') == 1 journalctl_sources += files('journal-qrcode.c', 'journal-qrcode.h') endif diff --git a/src/journal/mmap-cache.c b/src/journal/mmap-cache.c index 6e60d24dcf3..ac7252093b8 100644 --- a/src/journal/mmap-cache.c +++ b/src/journal/mmap-cache.c @@ -84,7 +84,7 @@ struct MMapCache { #define WINDOWS_MIN 64 -#ifdef ENABLE_DEBUG_MMAP_CACHE +#if ENABLE_DEBUG_MMAP_CACHE /* Tiny windows increase mmap activity and the chance of exposing unsafe use. */ # define WINDOW_SIZE (page_size()) #else @@ -225,7 +225,7 @@ static void context_detach_window(Context *c) { if (!w->contexts && !w->keep_always) { /* Not used anymore? */ -#ifdef ENABLE_DEBUG_MMAP_CACHE +#if ENABLE_DEBUG_MMAP_CACHE /* Unmap unused windows immediately to expose use-after-unmap * by SIGSEGV. */ window_free(w); diff --git a/src/journal/sd-journal.c b/src/journal/sd-journal.c index fb7269e5100..40805eb2b8d 100644 --- a/src/journal/sd-journal.c +++ b/src/journal/sd-journal.c @@ -2152,7 +2152,7 @@ _public_ int sd_journal_get_data(sd_journal *j, const char *field, const void ** compression = o->object.flags & OBJECT_COMPRESSION_MASK; if (compression) { -#if defined(HAVE_XZ) || defined(HAVE_LZ4) +#if HAVE_XZ || HAVE_LZ4 r = decompress_startswith(compression, o->data.payload, l, &f->compress_buffer, &f->compress_buffer_size, @@ -2216,7 +2216,7 @@ static int return_data(sd_journal *j, JournalFile *f, Object *o, const void **da compression = o->object.flags & OBJECT_COMPRESSION_MASK; if (compression) { -#if defined(HAVE_XZ) || defined(HAVE_LZ4) +#if HAVE_XZ || HAVE_LZ4 size_t rsize; int r; diff --git a/src/journal/test-compress-benchmark.c b/src/journal/test-compress-benchmark.c index 7bddd178c42..be5a6655a8e 100644 --- a/src/journal/test-compress-benchmark.c +++ b/src/journal/test-compress-benchmark.c @@ -31,7 +31,7 @@ typedef int (compress_t)(const void *src, uint64_t src_size, void *dst, typedef int (decompress_t)(const void *src, uint64_t src_size, void **dst, size_t *dst_alloc_size, size_t* dst_size, size_t dst_max); -#if defined(HAVE_XZ) || defined(HAVE_LZ4) +#if HAVE_XZ || HAVE_LZ4 static usec_t arg_duration; static size_t arg_start; @@ -157,7 +157,7 @@ static void test_compress_decompress(const char* label, const char* type, #endif int main(int argc, char *argv[]) { -#if defined(HAVE_XZ) || defined(HAVE_LZ4) +#if HAVE_XZ || HAVE_LZ4 const char *i; int r; @@ -183,10 +183,10 @@ int main(int argc, char *argv[]) { arg_start = getpid_cached(); NULSTR_FOREACH(i, "zeros\0simple\0random\0") { -#ifdef HAVE_XZ +#if HAVE_XZ test_compress_decompress("XZ", i, compress_blob_xz, decompress_blob_xz); #endif -#ifdef HAVE_LZ4 +#if HAVE_LZ4 test_compress_decompress("LZ4", i, compress_blob_lz4, decompress_blob_lz4); #endif } diff --git a/src/journal/test-compress.c b/src/journal/test-compress.c index 92108a84b3f..6948e8ccbe2 100644 --- a/src/journal/test-compress.c +++ b/src/journal/test-compress.c @@ -17,7 +17,7 @@ along with systemd; If not, see . ***/ -#ifdef HAVE_LZ4 +#if HAVE_LZ4 #include #endif @@ -29,13 +29,13 @@ #include "random-util.h" #include "util.h" -#ifdef HAVE_XZ +#if HAVE_XZ # define XZ_OK 0 #else # define XZ_OK -EPROTONOSUPPORT #endif -#ifdef HAVE_LZ4 +#if HAVE_LZ4 # define LZ4_OK 0 #else # define LZ4_OK -EPROTONOSUPPORT @@ -54,7 +54,7 @@ typedef int (decompress_sw_t)(const void *src, uint64_t src_size, typedef int (compress_stream_t)(int fdf, int fdt, uint64_t max_bytes); typedef int (decompress_stream_t)(int fdf, int fdt, uint64_t max_size); -#if defined(HAVE_XZ) || defined(HAVE_LZ4) +#if HAVE_XZ || HAVE_LZ4 static void test_compress_decompress(int compression, compress_blob_t compress, decompress_blob_t decompress, @@ -206,7 +206,7 @@ static void test_compress_stream(int compression, } #endif -#ifdef HAVE_LZ4 +#if HAVE_LZ4 static void test_lz4_decompress_partial(void) { char buf[20000]; size_t buf_size = sizeof(buf), compressed; @@ -249,7 +249,7 @@ static void test_lz4_decompress_partial(void) { #endif int main(int argc, char *argv[]) { -#if defined(HAVE_XZ) || defined(HAVE_LZ4) +#if HAVE_XZ || HAVE_LZ4 const char text[] = "text\0foofoofoofoo AAAA aaaaaaaaa ghost busters barbarbar FFF" "foofoofoofoo AAAA aaaaaaaaa ghost busters barbarbar FFF"; @@ -268,7 +268,7 @@ int main(int argc, char *argv[]) { random_bytes(data + 7, sizeof(data) - 7); -#ifdef HAVE_XZ +#if HAVE_XZ test_compress_decompress(OBJECT_COMPRESSED_XZ, compress_blob_xz, decompress_blob_xz, text, sizeof(text), false); test_compress_decompress(OBJECT_COMPRESSED_XZ, compress_blob_xz, decompress_blob_xz, @@ -290,7 +290,7 @@ int main(int argc, char *argv[]) { log_info("/* XZ test skipped */"); #endif -#ifdef HAVE_LZ4 +#if HAVE_LZ4 test_compress_decompress(OBJECT_COMPRESSED_LZ4, compress_blob_lz4, decompress_blob_lz4, text, sizeof(text), false); test_compress_decompress(OBJECT_COMPRESSED_LZ4, compress_blob_lz4, decompress_blob_lz4, diff --git a/src/journal/test-journal.c b/src/journal/test-journal.c index 2543d64b5bf..df685e90b62 100644 --- a/src/journal/test-journal.c +++ b/src/journal/test-journal.c @@ -58,7 +58,7 @@ static void test_non_empty(void) { iovec.iov_len = strlen(test); assert_se(journal_file_append_entry(f, &ts, &iovec, 1, NULL, NULL, NULL) == 0); -#ifdef HAVE_GCRYPT +#if HAVE_GCRYPT journal_file_append_tag(f); #endif journal_file_dump(f); diff --git a/src/libsystemd/sd-bus/bus-control.c b/src/libsystemd/sd-bus/bus-control.c index 3c770a6e2e4..fcd4d27e07e 100644 --- a/src/libsystemd/sd-bus/bus-control.c +++ b/src/libsystemd/sd-bus/bus-control.c @@ -17,7 +17,7 @@ along with systemd; If not, see . ***/ -#ifdef HAVE_VALGRIND_MEMCHECK_H +#if HAVE_VALGRIND_MEMCHECK_H #include #endif diff --git a/src/libsystemd/sd-bus/bus-kernel.c b/src/libsystemd/sd-bus/bus-kernel.c index 9b1dad9cfc4..5a3c4d6f506 100644 --- a/src/libsystemd/sd-bus/bus-kernel.c +++ b/src/libsystemd/sd-bus/bus-kernel.c @@ -17,7 +17,7 @@ along with systemd; If not, see . ***/ -#ifdef HAVE_VALGRIND_MEMCHECK_H +#if HAVE_VALGRIND_MEMCHECK_H #include #endif diff --git a/src/libsystemd/sd-bus/test-bus-gvariant.c b/src/libsystemd/sd-bus/test-bus-gvariant.c index e8301f95560..94fa9645957 100644 --- a/src/libsystemd/sd-bus/test-bus-gvariant.c +++ b/src/libsystemd/sd-bus/test-bus-gvariant.c @@ -17,7 +17,7 @@ along with systemd; If not, see . ***/ -#ifdef HAVE_GLIB +#if HAVE_GLIB #include #endif @@ -155,7 +155,7 @@ static void test_marshal(void) { assert_se(bus_message_seal(m, 4711, 0) >= 0); -#ifdef HAVE_GLIB +#if HAVE_GLIB { GVariant *v; char *t; @@ -184,7 +184,7 @@ static void test_marshal(void) { assert_se(bus_message_get_blob(m, &blob, &sz) >= 0); -#ifdef HAVE_GLIB +#if HAVE_GLIB { GVariant *v; char *t; diff --git a/src/libsystemd/sd-bus/test-bus-marshal.c b/src/libsystemd/sd-bus/test-bus-marshal.c index e60c30b1b40..221dbd35cc2 100644 --- a/src/libsystemd/sd-bus/test-bus-marshal.c +++ b/src/libsystemd/sd-bus/test-bus-marshal.c @@ -20,11 +20,11 @@ #include #include -#ifdef HAVE_GLIB +#if HAVE_GLIB #include #endif -#ifdef HAVE_DBUS +#if HAVE_DBUS #include #endif @@ -215,7 +215,7 @@ int main(int argc, char *argv[]) { log_info("message size = %zu, contents =\n%s", sz, h); free(h); -#ifdef HAVE_GLIB +#if HAVE_GLIB { GDBusMessage *g; char *p; @@ -232,7 +232,7 @@ int main(int argc, char *argv[]) { } #endif -#ifdef HAVE_DBUS +#if HAVE_DBUS { DBusMessage *w; DBusError error; diff --git a/src/libsystemd/sd-hwdb/sd-hwdb.c b/src/libsystemd/sd-hwdb/sd-hwdb.c index c155c701623..f8246eaa706 100644 --- a/src/libsystemd/sd-hwdb/sd-hwdb.c +++ b/src/libsystemd/sd-hwdb/sd-hwdb.c @@ -317,7 +317,7 @@ static const char hwdb_bin_paths[] = "/etc/systemd/hwdb/hwdb.bin\0" "/etc/udev/hwdb.bin\0" "/usr/lib/systemd/hwdb/hwdb.bin\0" -#ifdef HAVE_SPLIT_USR +#if HAVE_SPLIT_USR "/lib/systemd/hwdb/hwdb.bin\0" #endif UDEVLIBEXECDIR "/hwdb.bin\0"; diff --git a/src/libsystemd/sd-path/sd-path.c b/src/libsystemd/sd-path/sd-path.c index 6e41dac1ade..6570d013922 100644 --- a/src/libsystemd/sd-path/sd-path.c +++ b/src/libsystemd/sd-path/sd-path.c @@ -493,7 +493,7 @@ static int get_search(uint64_t type, char ***list) { "/usr/local/bin", "/usr/sbin", "/usr/bin", -#ifdef HAVE_SPLIT_USR +#if HAVE_SPLIT_USR "/sbin", "/bin", #endif @@ -507,7 +507,7 @@ static int get_search(uint64_t type, char ***list) { false, "/usr/local/lib", "/usr/lib", -#ifdef HAVE_SPLIT_USR +#if HAVE_SPLIT_USR "/lib", #endif NULL); @@ -519,7 +519,7 @@ static int get_search(uint64_t type, char ***list) { "LD_LIBRARY_PATH", true, LIBDIR, -#ifdef HAVE_SPLIT_USR +#if HAVE_SPLIT_USR ROOTLIBDIR, #endif NULL); diff --git a/src/locale/localed.c b/src/locale/localed.c index b4798d674c7..3c0c167dcfa 100644 --- a/src/locale/localed.c +++ b/src/locale/localed.c @@ -22,7 +22,7 @@ #include #include -#ifdef HAVE_XKBCOMMON +#if HAVE_XKBCOMMON #include #include #endif @@ -429,7 +429,7 @@ static int method_set_vc_keyboard(sd_bus_message *m, void *userdata, sd_bus_erro return sd_bus_reply_method_return(m, NULL); } -#ifdef HAVE_XKBCOMMON +#if HAVE_XKBCOMMON _printf_(3, 0) static void log_xkb(struct xkb_context *ctx, enum xkb_log_level lvl, const char *format, va_list args) { diff --git a/src/locale/meson.build b/src/locale/meson.build index d7dd113c8d0..e9de6089f31 100644 --- a/src/locale/meson.build +++ b/src/locale/meson.build @@ -6,7 +6,7 @@ systemd_localed_sources = files(''' localectl_sources = files('localectl.c') -if conf.get('ENABLE_LOCALED', false) +if conf.get('ENABLE_LOCALED') == 1 install_data('org.freedesktop.locale1.conf', install_dir : dbuspolicydir) install_data('org.freedesktop.locale1.service', @@ -27,7 +27,7 @@ endif kbd_model_map = join_paths(meson.current_source_dir(), 'kbd-model-map') language_fallback_map = join_paths(meson.current_source_dir(), 'language-fallback-map') -if conf.get('ENABLE_LOCALED', false) +if conf.get('ENABLE_LOCALED') == 1 install_data('kbd-model-map', 'language-fallback-map', install_dir : pkgdatadir) diff --git a/src/login/logind-acl.h b/src/login/logind-acl.h index 1286c6a3cd7..606005a6f1b 100644 --- a/src/login/logind-acl.h +++ b/src/login/logind-acl.h @@ -24,7 +24,7 @@ #include "libudev.h" -#ifdef HAVE_ACL +#if HAVE_ACL int devnode_acl(const char *path, bool flush, diff --git a/src/login/meson.build b/src/login/meson.build index 26bdbec4241..d0723f134f4 100644 --- a/src/login/meson.build +++ b/src/login/meson.build @@ -39,7 +39,7 @@ liblogind_core_sources = files(''' '''.split()) logind_acl_c = files('logind-acl.c') -if conf.get('HAVE_ACL', false) +if conf.get('HAVE_ACL') == 1 liblogind_core_sources += logind_acl_c endif @@ -55,7 +55,7 @@ loginctl_sources = files(''' sysfs-show.c '''.split()) -if conf.get('ENABLE_LOGIND', false) +if conf.get('ENABLE_LOGIND') == 1 logind_conf = configure_file( input : 'logind.conf.in', output : 'logind.conf', diff --git a/src/machine/meson.build b/src/machine/meson.build index 1a0813323c1..693503da539 100644 --- a/src/machine/meson.build +++ b/src/machine/meson.build @@ -21,7 +21,7 @@ libmachine_core = static_library( include_directories : includes, dependencies : [threads]) -if conf.get('ENABLE_MACHINED', false) +if conf.get('ENABLE_MACHINED') == 1 install_data('org.freedesktop.machine1.conf', install_dir : dbuspolicydir) install_data('org.freedesktop.machine1.service', diff --git a/src/network/meson.build b/src/network/meson.build index 83a837d6c9c..38c2220e8b5 100644 --- a/src/network/meson.build +++ b/src/network/meson.build @@ -81,7 +81,7 @@ networkctl_sources = files('networkctl.c') network_include_dir = include_directories('.') -if conf.get('ENABLE_NETWORKD', false) +if conf.get('ENABLE_NETWORKD') == 1 networkd_gperf_c = custom_target( 'networkd-gperf.c', input : 'networkd-gperf.gperf', diff --git a/src/network/networkd-manager.c b/src/network/networkd-manager.c index 1e82c87d367..71445d5dda0 100644 --- a/src/network/networkd-manager.c +++ b/src/network/networkd-manager.c @@ -48,7 +48,7 @@ const char* const network_dirs[] = { "/etc/systemd/network", "/run/systemd/network", "/usr/lib/systemd/network", -#ifdef HAVE_SPLIT_USR +#if HAVE_SPLIT_USR "/lib/systemd/network", #endif NULL}; diff --git a/src/nspawn/nspawn-mount.c b/src/nspawn/nspawn-mount.c index e80c944e9fe..531f29cb7b5 100644 --- a/src/nspawn/nspawn-mount.c +++ b/src/nspawn/nspawn-mount.c @@ -374,7 +374,7 @@ static int tmpfs_patch_options( options = buf; } -#ifdef HAVE_SELINUX +#if HAVE_SELINUX if (selinux_apifs_context) { char *t; @@ -557,7 +557,7 @@ int mount_all(const char *dest, { "tmpfs", "/dev", "tmpfs", "mode=755", MS_NOSUID|MS_STRICTATIME, MOUNT_FATAL }, { "tmpfs", "/dev/shm", "tmpfs", "mode=1777", MS_NOSUID|MS_NODEV|MS_STRICTATIME, MOUNT_FATAL }, { "tmpfs", "/run", "tmpfs", "mode=755", MS_NOSUID|MS_NODEV|MS_STRICTATIME, MOUNT_FATAL }, -#ifdef HAVE_SELINUX +#if HAVE_SELINUX { "/sys/fs/selinux", "/sys/fs/selinux", NULL, NULL, MS_BIND, 0 }, /* Bind mount first */ { NULL, "/sys/fs/selinux", NULL, NULL, MS_BIND|MS_RDONLY|MS_NOSUID|MS_NOEXEC|MS_NODEV|MS_REMOUNT, 0 }, /* Then, make it r/o */ #endif diff --git a/src/nspawn/nspawn-patch-uid.c b/src/nspawn/nspawn-patch-uid.c index f861db879a7..063fdb1053e 100644 --- a/src/nspawn/nspawn-patch-uid.c +++ b/src/nspawn/nspawn-patch-uid.c @@ -19,7 +19,7 @@ #include #include -#ifdef HAVE_ACL +#if HAVE_ACL #include #endif #include @@ -37,7 +37,7 @@ #include "strv.h" #include "user-util.h" -#ifdef HAVE_ACL +#if HAVE_ACL static int get_acl(int fd, const char *name, acl_type_t type, acl_t *ret) { char procfs_path[strlen("/proc/self/fd/") + DECIMAL_STR_MAX(int) + 1]; diff --git a/src/nspawn/nspawn-seccomp.c b/src/nspawn/nspawn-seccomp.c index 38c2b12e952..196766dc984 100644 --- a/src/nspawn/nspawn-seccomp.c +++ b/src/nspawn/nspawn-seccomp.c @@ -22,20 +22,20 @@ #include #include -#ifdef HAVE_SECCOMP +#if HAVE_SECCOMP #include #endif #include "alloc-util.h" #include "log.h" #include "nspawn-seccomp.h" -#ifdef HAVE_SECCOMP +#if HAVE_SECCOMP #include "seccomp-util.h" #endif #include "string-util.h" #include "strv.h" -#ifdef HAVE_SECCOMP +#if HAVE_SECCOMP static int seccomp_add_default_syscall_filter( scmp_filter_ctx ctx, diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c index 82fd0bd5f4a..4e3803be822 100644 --- a/src/nspawn/nspawn.c +++ b/src/nspawn/nspawn.c @@ -17,7 +17,7 @@ along with systemd; If not, see . ***/ -#ifdef HAVE_BLKID +#if HAVE_BLKID #include #endif #include @@ -26,7 +26,7 @@ #include #include #include -#ifdef HAVE_SELINUX +#if HAVE_SELINUX #include #endif #include @@ -1234,7 +1234,7 @@ static int verify_arguments(void) { return -EINVAL; } -#ifndef HAVE_LIBIPTC +#if ! HAVE_LIBIPTC if (arg_expose_ports) { log_error("--port= is not supported, compiled without libiptc support."); return -EOPNOTSUPP; @@ -1547,7 +1547,7 @@ static int setup_pts(const char *dest) { const char *p; int r; -#ifdef HAVE_SELINUX +#if HAVE_SELINUX if (arg_selinux_apifs_context) (void) asprintf(&options, "newinstance,ptmxmode=0666,mode=620,gid=" GID_FMT ",context=\"%s\"", @@ -2332,7 +2332,7 @@ static int inner_child( return log_error_errno(r, "personality() failed: %m"); } -#ifdef HAVE_SELINUX +#if HAVE_SELINUX if (arg_selinux_context) if (setexeccon(arg_selinux_context) < 0) return log_error_errno(errno, "setexeccon(\"%s\") failed: %m", arg_selinux_context); diff --git a/src/quotacheck/quotacheck.c b/src/quotacheck/quotacheck.c index a42fce377e3..1339564edb4 100644 --- a/src/quotacheck/quotacheck.c +++ b/src/quotacheck/quotacheck.c @@ -49,7 +49,7 @@ static int parse_proc_cmdline_item(const char *key, const char *value, void *dat log_warning("Invalid quotacheck.mode= parameter '%s'. Ignoring.", value); } -#ifdef HAVE_SYSV_COMPAT +#if HAVE_SYSV_COMPAT else if (streq(key, "forcequotacheck") && !value) { log_warning("Please use 'quotacheck.mode=force' rather than 'forcequotacheck' on the kernel command line."); arg_force = true; @@ -61,7 +61,7 @@ static int parse_proc_cmdline_item(const char *key, const char *value, void *dat static void test_files(void) { -#ifdef HAVE_SYSV_COMPAT +#if HAVE_SYSV_COMPAT if (access("/forcequotacheck", F_OK) >= 0) { log_error("Please pass 'quotacheck.mode=force' on the kernel command line rather than creating /forcequotacheck on the root file system."); arg_force = true; diff --git a/src/resolve/meson.build b/src/resolve/meson.build index fe228784fac..935214d6a51 100644 --- a/src/resolve/meson.build +++ b/src/resolve/meson.build @@ -123,7 +123,7 @@ systemd_resolve_sources = (basic_dns_sources + systemd_resolve_only_sources + dns_type_headers) -if conf.get('ENABLE_RESOLVED', false) +if conf.get('ENABLE_RESOLVED') == 1 install_data('org.freedesktop.resolve1.conf', install_dir : dbuspolicydir) install_data('org.freedesktop.resolve1.service', diff --git a/src/resolve/resolved-conf.c b/src/resolve/resolved-conf.c index 75636e0e564..3cf4261ff0a 100644 --- a/src/resolve/resolved-conf.c +++ b/src/resolve/resolved-conf.c @@ -246,7 +246,7 @@ int manager_parse_config_file(Manager *m) { return r; } -#ifndef HAVE_GCRYPT +#if ! HAVE_GCRYPT if (m->dnssec_mode != DNSSEC_NO) { log_warning("DNSSEC option cannot be enabled or set to allow-downgrade when systemd-resolved is built without gcrypt support. Turning off DNSSEC support."); m->dnssec_mode = DNSSEC_NO; diff --git a/src/resolve/resolved-dns-dnssec.c b/src/resolve/resolved-dns-dnssec.c index eddab58a818..4f398d8119e 100644 --- a/src/resolve/resolved-dns-dnssec.c +++ b/src/resolve/resolved-dns-dnssec.c @@ -17,7 +17,7 @@ along with systemd; If not, see . ***/ -#ifdef HAVE_GCRYPT +#if HAVE_GCRYPT #include #endif @@ -125,7 +125,7 @@ int dnssec_canonicalize(const char *n, char *buffer, size_t buffer_max) { return (int) c; } -#ifdef HAVE_GCRYPT +#if HAVE_GCRYPT static int rr_compare(const void *a, const void *b) { DnsResourceRecord **x = (DnsResourceRecord**) a, **y = (DnsResourceRecord**) b; diff --git a/src/resolve/resolved-link.c b/src/resolve/resolved-link.c index 95795e4d242..21fd8465e6d 100644 --- a/src/resolve/resolved-link.c +++ b/src/resolve/resolved-link.c @@ -313,7 +313,7 @@ void link_set_dnssec_mode(Link *l, DnssecMode mode) { assert(l); -#ifndef HAVE_GCRYPT +#if ! HAVE_GCRYPT if (IN_SET(mode, DNSSEC_YES, DNSSEC_ALLOW_DOWNGRADE)) log_warning("DNSSEC option for the link cannot be enabled or set to allow-downgrade when systemd-resolved is built without gcrypt support. Turning off DNSSEC support."); return; diff --git a/src/resolve/resolved-manager.c b/src/resolve/resolved-manager.c index b6620875eae..c8961f20a70 100644 --- a/src/resolve/resolved-manager.c +++ b/src/resolve/resolved-manager.c @@ -21,7 +21,7 @@ #include #include -#ifdef HAVE_LIBIDN2 +#if HAVE_LIBIDN2 #include #endif @@ -328,9 +328,9 @@ static int manager_network_monitor_listen(Manager *m) { static int determine_hostname(char **full_hostname, char **llmnr_hostname, char **mdns_hostname) { _cleanup_free_ char *h = NULL, *n = NULL; -#if defined(HAVE_LIBIDN2) +#if HAVE_LIBIDN2 _cleanup_free_ char *utf8 = NULL; -#elif defined(HAVE_LIBIDN) +#elif HAVE_LIBIDN int k; #endif char label[DNS_LABEL_MAX]; @@ -356,7 +356,7 @@ static int determine_hostname(char **full_hostname, char **llmnr_hostname, char return -EINVAL; } -#if defined(HAVE_LIBIDN2) +#if HAVE_LIBIDN2 r = idn2_to_unicode_8z8z(label, &utf8, 0); if (r != IDN2_OK) return log_error("Failed to undo IDNA: %s", idn2_strerror(r)); @@ -364,7 +364,7 @@ static int determine_hostname(char **full_hostname, char **llmnr_hostname, char r = strlen(utf8); decoded = utf8; -#elif defined(HAVE_LIBIDN) +#elif HAVE_LIBIDN k = dns_label_undo_idna(label, r, label, sizeof label); if (k < 0) return log_error_errno(k, "Failed to undo IDNA: %m"); diff --git a/src/resolve/test-dnssec-complex.c b/src/resolve/test-dnssec-complex.c index 090b2fac23b..25ec6f4352a 100644 --- a/src/resolve/test-dnssec-complex.c +++ b/src/resolve/test-dnssec-complex.c @@ -218,7 +218,7 @@ int main(int argc, char* argv[]) { test_hostname_lookup(bus, "poettering.de", AF_INET, NULL); test_hostname_lookup(bus, "poettering.de", AF_INET6, NULL); -#if defined(HAVE_LIBIDN2) || defined(HAVE_LIBIDN) +#if HAVE_LIBIDN2 || HAVE_LIBIDN /* Unsigned A with IDNA conversion necessary */ test_hostname_lookup(bus, "pöttering.de", AF_UNSPEC, NULL); test_hostname_lookup(bus, "pöttering.de", AF_INET, NULL); diff --git a/src/resolve/test-dnssec.c b/src/resolve/test-dnssec.c index b3018e82395..8cb4b503938 100644 --- a/src/resolve/test-dnssec.c +++ b/src/resolve/test-dnssec.c @@ -47,7 +47,7 @@ static void test_dnssec_canonicalize(void) { test_dnssec_canonicalize_one("FOO..bar.", NULL, -EINVAL); } -#ifdef HAVE_GCRYPT +#if HAVE_GCRYPT static void test_dnssec_verify_dns_key(void) { @@ -332,7 +332,7 @@ int main(int argc, char*argv[]) { test_dnssec_canonicalize(); -#ifdef HAVE_GCRYPT +#if HAVE_GCRYPT test_dnssec_verify_dns_key(); test_dnssec_verify_rrset(); test_dnssec_verify_rrset2(); diff --git a/src/shared/acl-util.h b/src/shared/acl-util.h index 396e9e067ee..a0e31d8e29b 100644 --- a/src/shared/acl-util.h +++ b/src/shared/acl-util.h @@ -19,7 +19,7 @@ along with systemd; If not, see . ***/ -#ifdef HAVE_ACL +#if HAVE_ACL #include #include diff --git a/src/shared/bus-unit-util.c b/src/shared/bus-unit-util.c index a08f17d8210..e191f8c93ef 100644 --- a/src/shared/bus-unit-util.c +++ b/src/shared/bus-unit-util.c @@ -598,7 +598,7 @@ int bus_append_unit_property_assignment(sd_bus_message *m, const char *assignmen r = sd_bus_message_append(m, "v", "i", (int32_t) n); -#ifdef HAVE_SECCOMP +#if HAVE_SECCOMP } else if (streq(field, "SystemCallFilter")) { int whitelist; diff --git a/src/shared/bus-util.c b/src/shared/bus-util.c index a9a763c1cab..7609d9c5226 100644 --- a/src/shared/bus-util.c +++ b/src/shared/bus-util.c @@ -255,7 +255,7 @@ int bus_test_polkit( return r; else if (r > 0) return 1; -#ifdef ENABLE_POLKIT +#if ENABLE_POLKIT else { _cleanup_(sd_bus_message_unrefp) sd_bus_message *request = NULL; _cleanup_(sd_bus_message_unrefp) sd_bus_message *reply = NULL; @@ -334,7 +334,7 @@ int bus_test_polkit( return -EACCES; } -#ifdef ENABLE_POLKIT +#if ENABLE_POLKIT typedef struct AsyncPolkitQuery { sd_bus_message *request, *reply; @@ -398,7 +398,7 @@ int bus_verify_polkit_async( Hashmap **registry, sd_bus_error *error) { -#ifdef ENABLE_POLKIT +#if ENABLE_POLKIT _cleanup_(sd_bus_message_unrefp) sd_bus_message *pk = NULL; AsyncPolkitQuery *q; const char *sender, **k, **v; @@ -416,7 +416,7 @@ int bus_verify_polkit_async( if (r != 0) return r; -#ifdef ENABLE_POLKIT +#if ENABLE_POLKIT q = hashmap_get(*registry, call); if (q) { int authorized, challenge; @@ -463,7 +463,7 @@ int bus_verify_polkit_async( else if (r > 0) return 1; -#ifdef ENABLE_POLKIT +#if ENABLE_POLKIT if (sd_bus_get_current_message(call->bus) != call) return -EINVAL; @@ -552,7 +552,7 @@ int bus_verify_polkit_async( } void bus_verify_polkit_async_registry_free(Hashmap *registry) { -#ifdef ENABLE_POLKIT +#if ENABLE_POLKIT AsyncPolkitQuery *q; while ((q = hashmap_steal_first(registry))) diff --git a/src/shared/dissect-image.c b/src/shared/dissect-image.c index 243a46f2e3c..dd8650e1a8b 100644 --- a/src/shared/dissect-image.c +++ b/src/shared/dissect-image.c @@ -17,7 +17,7 @@ along with systemd; If not, see . ***/ -#ifdef HAVE_LIBCRYPTSETUP +#if HAVE_LIBCRYPTSETUP #include #endif #include @@ -43,7 +43,7 @@ #include "xattr-util.h" _unused_ static int probe_filesystem(const char *node, char **ret_fstype) { -#ifdef HAVE_BLKID +#if HAVE_BLKID _cleanup_blkid_free_probe_ blkid_probe b = NULL; const char *fstype; int r; @@ -87,7 +87,7 @@ not_found: int dissect_image(int fd, const void *root_hash, size_t root_hash_size, DissectImageFlags flags, DissectedImage **ret) { -#ifdef HAVE_BLKID +#if HAVE_BLKID sd_id128_t root_uuid = SD_ID128_NULL, verity_uuid = SD_ID128_NULL; _cleanup_udev_enumerate_unref_ struct udev_enumerate *e = NULL; bool is_gpt, is_mbr, generic_rw, multiple_generic = false; @@ -737,7 +737,7 @@ int dissected_image_mount(DissectedImage *m, const char *where, DissectImageFlag return 0; } -#ifdef HAVE_LIBCRYPTSETUP +#if HAVE_LIBCRYPTSETUP typedef struct DecryptedPartition { struct crypt_device *device; char *name; @@ -752,7 +752,7 @@ struct DecryptedImage { #endif DecryptedImage* decrypted_image_unref(DecryptedImage* d) { -#ifdef HAVE_LIBCRYPTSETUP +#if HAVE_LIBCRYPTSETUP size_t i; int r; @@ -778,7 +778,7 @@ DecryptedImage* decrypted_image_unref(DecryptedImage* d) { return NULL; } -#ifdef HAVE_LIBCRYPTSETUP +#if HAVE_LIBCRYPTSETUP static int make_dm_name_and_node(const void *original_node, const char *suffix, char **ret_name, char **ret_node) { _cleanup_free_ char *name = NULL, *node = NULL; @@ -952,7 +952,7 @@ int dissected_image_decrypt( DecryptedImage **ret) { _cleanup_(decrypted_image_unrefp) DecryptedImage *d = NULL; -#ifdef HAVE_LIBCRYPTSETUP +#if HAVE_LIBCRYPTSETUP unsigned i; int r; #endif @@ -976,7 +976,7 @@ int dissected_image_decrypt( return 0; } -#ifdef HAVE_LIBCRYPTSETUP +#if HAVE_LIBCRYPTSETUP if (m->encrypted && !passphrase) return -ENOKEY; @@ -1058,7 +1058,7 @@ int dissected_image_decrypt_interactively( } } -#ifdef HAVE_LIBCRYPTSETUP +#if HAVE_LIBCRYPTSETUP static int deferred_remove(DecryptedPartition *p) { struct dm_ioctl dm = { @@ -1092,7 +1092,7 @@ static int deferred_remove(DecryptedPartition *p) { int decrypted_image_relinquish(DecryptedImage *d) { -#ifdef HAVE_LIBCRYPTSETUP +#if HAVE_LIBCRYPTSETUP size_t i; int r; #endif @@ -1102,7 +1102,7 @@ int decrypted_image_relinquish(DecryptedImage *d) { /* Turns on automatic removal after the last use ended for all DM devices of this image, and sets a boolean so * that we don't clean it up ourselves either anymore */ -#ifdef HAVE_LIBCRYPTSETUP +#if HAVE_LIBCRYPTSETUP for (i = 0; i < d->n_decrypted; i++) { DecryptedPartition *p = d->decrypted + i; diff --git a/src/shared/dns-domain.c b/src/shared/dns-domain.c index 139d286af8d..9804907304b 100644 --- a/src/shared/dns-domain.c +++ b/src/shared/dns-domain.c @@ -17,9 +17,9 @@ along with systemd; If not, see . ***/ -#if defined(HAVE_LIBIDN2) +#if HAVE_LIBIDN2 # include -#elif defined(HAVE_LIBIDN) +#elif HAVE_LIBIDN # include # include #endif @@ -301,7 +301,7 @@ int dns_label_escape_new(const char *p, size_t l, char **ret) { return r; } -#ifdef HAVE_LIBIDN +#if HAVE_LIBIDN int dns_label_apply_idna(const char *encoded, size_t encoded_size, char *decoded, size_t decoded_max) { _cleanup_free_ uint32_t *input = NULL; size_t input_size, l; @@ -1272,7 +1272,7 @@ int dns_name_common_suffix(const char *a, const char *b, const char **ret) { int dns_name_apply_idna(const char *name, char **ret) { /* Return negative on error, 0 if not implemented, positive on success. */ -#if defined(HAVE_LIBIDN2) +#if HAVE_LIBIDN2 int r; _cleanup_free_ char *t = NULL; @@ -1312,7 +1312,7 @@ int dns_name_apply_idna(const char *name, char **ret) { if (IN_SET(r, IDN2_TOO_BIG_DOMAIN, IDN2_TOO_BIG_LABEL)) return -ENOSPC; return -EINVAL; -#elif defined(HAVE_LIBIDN) +#elif HAVE_LIBIDN _cleanup_free_ char *buf = NULL; size_t n = 0, allocated = 0; bool first = true; diff --git a/src/shared/dns-domain.h b/src/shared/dns-domain.h index fca025def01..a44d9d48d47 100644 --- a/src/shared/dns-domain.h +++ b/src/shared/dns-domain.h @@ -51,7 +51,7 @@ static inline int dns_name_parent(const char **name) { return dns_label_unescape(name, NULL, DNS_LABEL_MAX); } -#if defined(HAVE_LIBIDN) +#if HAVE_LIBIDN int dns_label_apply_idna(const char *encoded, size_t encoded_size, char *decoded, size_t decoded_max); int dns_label_undo_idna(const char *encoded, size_t encoded_size, char *decoded, size_t decoded_max); #endif diff --git a/src/shared/efivars.c b/src/shared/efivars.c index 2503346610e..a3850bede27 100644 --- a/src/shared/efivars.c +++ b/src/shared/efivars.c @@ -42,7 +42,7 @@ #include "util.h" #include "virt.h" -#ifdef ENABLE_EFI +#if ENABLE_EFI #define LOAD_OPTION_ACTIVE 0x00000001 #define MEDIA_DEVICE_PATH 0x04 diff --git a/src/shared/efivars.h b/src/shared/efivars.h index b61d14c4ec1..72bace0d07a 100644 --- a/src/shared/efivars.h +++ b/src/shared/efivars.h @@ -33,7 +33,7 @@ #define EFI_VARIABLE_BOOTSERVICE_ACCESS 0x0000000000000002 #define EFI_VARIABLE_RUNTIME_ACCESS 0x0000000000000004 -#ifdef ENABLE_EFI +#if ENABLE_EFI bool is_efi_boot(void); bool is_efi_secure_boot(void); diff --git a/src/shared/firewall-util.h b/src/shared/firewall-util.h index c39b34cf8f8..5915266b4bf 100644 --- a/src/shared/firewall-util.h +++ b/src/shared/firewall-util.h @@ -24,7 +24,7 @@ #include "in-addr-util.h" -#ifdef HAVE_LIBIPTC +#if HAVE_LIBIPTC int fw_add_masquerade( bool add, diff --git a/src/shared/gcrypt-util.c b/src/shared/gcrypt-util.c index 39b544b6f09..e10a38dcfc0 100644 --- a/src/shared/gcrypt-util.c +++ b/src/shared/gcrypt-util.c @@ -19,7 +19,7 @@ along with systemd; If not, see . ***/ -#ifdef HAVE_GCRYPT +#if HAVE_GCRYPT #include #include "gcrypt-util.h" diff --git a/src/shared/gcrypt-util.h b/src/shared/gcrypt-util.h index 1da12a32be2..f08ed6052cc 100644 --- a/src/shared/gcrypt-util.h +++ b/src/shared/gcrypt-util.h @@ -23,7 +23,7 @@ #include #include -#ifdef HAVE_GCRYPT +#if HAVE_GCRYPT #include void initialize_libgcrypt(bool secmem); @@ -31,7 +31,7 @@ int string_hashsum(const char *s, size_t len, int md_algorithm, char **out); #endif static inline int string_hashsum_sha224(const char *s, size_t len, char **out) { -#ifdef HAVE_GCRYPT +#if HAVE_GCRYPT return string_hashsum(s, len, GCRY_MD_SHA224, out); #else return -EOPNOTSUPP; @@ -39,7 +39,7 @@ static inline int string_hashsum_sha224(const char *s, size_t len, char **out) { } static inline int string_hashsum_sha256(const char *s, size_t len, char **out) { -#ifdef HAVE_GCRYPT +#if HAVE_GCRYPT return string_hashsum(s, len, GCRY_MD_SHA256, out); #else return -EOPNOTSUPP; diff --git a/src/shared/install.c b/src/shared/install.c index 0a8628c26ad..7598bf6a23c 100644 --- a/src/shared/install.c +++ b/src/shared/install.c @@ -286,7 +286,7 @@ static int path_is_vendor(const LookupPaths *p, const char *path) { if (path_startswith(rpath, "/usr")) return true; -#ifdef HAVE_SPLIT_USR +#if HAVE_SPLIT_USR if (path_startswith(rpath, "/lib")) return true; #endif @@ -2739,7 +2739,7 @@ static int read_presets(UnitFileScope scope, const char *root_dir, Presets *pres "/etc/systemd/system-preset", "/usr/local/lib/systemd/system-preset", "/usr/lib/systemd/system-preset", -#ifdef HAVE_SPLIT_USR +#if HAVE_SPLIT_USR "/lib/systemd/system-preset", #endif NULL); diff --git a/src/shared/journal-util.c b/src/shared/journal-util.c index 8479221a447..fff3dfc9d13 100644 --- a/src/shared/journal-util.c +++ b/src/shared/journal-util.c @@ -28,7 +28,7 @@ #include "user-util.h" static int access_check_var_log_journal(sd_journal *j) { -#ifdef HAVE_ACL +#if HAVE_ACL _cleanup_strv_free_ char **g = NULL; const char* dir; #endif @@ -48,7 +48,7 @@ static int access_check_var_log_journal(sd_journal *j) { if (r > 0) return 0; -#ifdef HAVE_ACL +#if HAVE_ACL if (laccess("/run/log/journal", F_OK) >= 0) dir = "/run/log/journal"; else diff --git a/src/shared/meson.build b/src/shared/meson.build index ce84d007d16..bb9720a94a9 100644 --- a/src/shared/meson.build +++ b/src/shared/meson.build @@ -104,19 +104,19 @@ shared_sources = ''' test_tables_h = files('test-tables.h') shared_sources += [test_tables_h] -if conf.get('HAVE_ACL', false) +if conf.get('HAVE_ACL') == 1 shared_sources += ['acl-util.c'] endif -if conf.get('HAVE_UTMP', false) +if conf.get('HAVE_UTMP') == 1 shared_sources += ['utmp-wtmp.c'] endif -if conf.get('HAVE_SECCOMP', false) +if conf.get('HAVE_SECCOMP') == 1 shared_sources += ['seccomp-util.c'] endif -if conf.get('HAVE_LIBIPTC', false) +if conf.get('HAVE_LIBIPTC') == 1 shared_sources += ['firewall-util.c'] endif diff --git a/src/shared/path-lookup.c b/src/shared/path-lookup.c index bf10acda944..68c392e1c0e 100644 --- a/src/shared/path-lookup.c +++ b/src/shared/path-lookup.c @@ -576,7 +576,7 @@ int lookup_paths_init( "/usr/local/lib/systemd/system", SYSTEM_DATA_UNIT_PATH, "/usr/lib/systemd/system", -#ifdef HAVE_SPLIT_USR +#if HAVE_SPLIT_USR "/lib/systemd/system", #endif STRV_IFNOTNULL(generator_late), diff --git a/src/shared/spawn-polkit-agent.c b/src/shared/spawn-polkit-agent.c index 7dae4d14fe2..9a401476629 100644 --- a/src/shared/spawn-polkit-agent.c +++ b/src/shared/spawn-polkit-agent.c @@ -33,7 +33,7 @@ #include "time-util.h" #include "util.h" -#ifdef ENABLE_POLKIT +#if ENABLE_POLKIT static pid_t agent_pid = 0; int polkit_agent_open(void) { diff --git a/src/shared/utmp-wtmp.h b/src/shared/utmp-wtmp.h index 438e270a26b..8da594100aa 100644 --- a/src/shared/utmp-wtmp.h +++ b/src/shared/utmp-wtmp.h @@ -25,7 +25,7 @@ #include "time-util.h" #include "util.h" -#ifdef HAVE_UTMP +#if HAVE_UTMP int utmp_get_runlevel(int *runlevel, int *previous); int utmp_put_shutdown(void); diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c index 897fc48b989..17ea5c3a32e 100644 --- a/src/systemctl/systemctl.c +++ b/src/systemctl/systemctl.c @@ -3219,7 +3219,7 @@ static int start_unit(int argc, char *argv[], void *userdata) { return r; } -#ifdef ENABLE_LOGIND +#if ENABLE_LOGIND static int logind_set_wall_message(void) { _cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL; sd_bus *bus; @@ -3255,7 +3255,7 @@ static int logind_set_wall_message(void) { /* Ask systemd-logind, which might grant access to unprivileged users * through PolicyKit */ static int logind_reboot(enum action a) { -#ifdef ENABLE_LOGIND +#if ENABLE_LOGIND _cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL; const char *method, *description; sd_bus *bus; @@ -3318,7 +3318,7 @@ static int logind_reboot(enum action a) { } static int logind_check_inhibitors(enum action a) { -#ifdef ENABLE_LOGIND +#if ENABLE_LOGIND _cleanup_(sd_bus_message_unrefp) sd_bus_message *reply = NULL; _cleanup_strv_free_ char **sessions = NULL; const char *what, *who, *why, *mode; @@ -3439,7 +3439,7 @@ static int logind_check_inhibitors(enum action a) { } static int logind_prepare_firmware_setup(void) { -#ifdef ENABLE_LOGIND +#if ENABLE_LOGIND _cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL; sd_bus *bus; int r; @@ -5903,7 +5903,7 @@ static int import_environment(int argc, char *argv[], void *userdata) { static int enable_sysv_units(const char *verb, char **args) { int r = 0; -#if defined(HAVE_SYSV_COMPAT) +#if HAVE_SYSV_COMPAT _cleanup_lookup_paths_free_ LookupPaths paths = {}; unsigned f = 0; @@ -8211,7 +8211,7 @@ static int parse_argv(int argc, char *argv[]) { return systemctl_parse_argv(argc, argv); } -#ifdef HAVE_SYSV_COMPAT +#if HAVE_SYSV_COMPAT _pure_ static int action_to_runlevel(void) { static const char table[_ACTION_MAX] = { @@ -8232,7 +8232,7 @@ _pure_ static int action_to_runlevel(void) { #endif static int talk_initctl(void) { -#ifdef HAVE_SYSV_COMPAT +#if HAVE_SYSV_COMPAT struct init_request request = { .magic = INIT_MAGIC, .sleeptime = 0, @@ -8426,7 +8426,7 @@ static int halt_now(enum action a) { static int logind_schedule_shutdown(void) { -#ifdef ENABLE_LOGIND +#if ENABLE_LOGIND _cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL; char date[FORMAT_TIMESTAMP_MAX]; const char *action; @@ -8555,7 +8555,7 @@ static int runlevel_main(void) { } static int logind_cancel_shutdown(void) { -#ifdef ENABLE_LOGIND +#if ENABLE_LOGIND _cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL; sd_bus *bus; int r; diff --git a/src/sysusers/sysusers.c b/src/sysusers/sysusers.c index e9e6dae10c7..6f0e83d51e8 100644 --- a/src/sysusers/sysusers.c +++ b/src/sysusers/sysusers.c @@ -299,7 +299,7 @@ static int putgrent_with_members(const struct group *gr, FILE *group) { return 0; } -#ifdef ENABLE_GSHADOW +#if ENABLE_GSHADOW static int putsgent_with_members(const struct sgrp *sg, FILE *gshadow) { char **a; @@ -636,7 +636,7 @@ static int write_temporary_group(const char *group_path, FILE **tmpfile, char ** } static int write_temporary_gshadow(const char * gshadow_path, FILE **tmpfile, char **tmpfile_path) { -#ifdef ENABLE_GSHADOW +#if ENABLE_GSHADOW _cleanup_fclose_ FILE *original = NULL, *gshadow = NULL; _cleanup_(unlink_and_freep) char *gshadow_tmp = NULL; bool group_changed = false; diff --git a/src/test/test-dns-domain.c b/src/test/test-dns-domain.c index 93b758ec7aa..75bc5e4a73f 100644 --- a/src/test/test-dns-domain.c +++ b/src/test/test-dns-domain.c @@ -624,7 +624,7 @@ static void test_dns_name_apply_idna_one(const char *s, int expected, const char } static void test_dns_name_apply_idna(void) { -#if defined HAVE_LIBIDN2 || defined HAVE_LIBIDN +#if HAVE_LIBIDN2 || HAVE_LIBIDN const int ret = 1; #else const int ret = 0; @@ -638,7 +638,7 @@ static void test_dns_name_apply_idna(void) { * labels. If registrars follow IDNA2008 we'll just be performing a * useless lookup. */ -#if defined HAVE_LIBIDN +#if HAVE_LIBIDN const int ret2 = 1; #else const int ret2 = 0; diff --git a/src/test/test-execute.c b/src/test/test-execute.c index 68166cf749b..6786d561977 100644 --- a/src/test/test-execute.c +++ b/src/test/test-execute.c @@ -30,7 +30,7 @@ #include "mkdir.h" #include "path-util.h" #include "rm-rf.h" -#ifdef HAVE_SECCOMP +#if HAVE_SECCOMP #include "seccomp-util.h" #endif #include "stat-util.h" @@ -243,7 +243,7 @@ static void test_exec_inaccessiblepaths_proc(Manager *m) { } static void test_exec_systemcallfilter(Manager *m) { -#ifdef HAVE_SECCOMP +#if HAVE_SECCOMP if (!is_seccomp_available()) return; test(m, "exec-systemcallfilter-not-failing.service", 0, CLD_EXITED); @@ -255,14 +255,14 @@ static void test_exec_systemcallfilter(Manager *m) { } static void test_exec_systemcallerrornumber(Manager *m) { -#ifdef HAVE_SECCOMP +#if HAVE_SECCOMP if (is_seccomp_available()) test(m, "exec-systemcallerrornumber.service", 1, CLD_EXITED); #endif } static void test_exec_restrict_namespaces(Manager *m) { -#ifdef HAVE_SECCOMP +#if HAVE_SECCOMP if (!is_seccomp_available()) return; @@ -274,7 +274,7 @@ static void test_exec_restrict_namespaces(Manager *m) { } static void test_exec_systemcall_system_mode_with_user(Manager *m) { -#ifdef HAVE_SECCOMP +#if HAVE_SECCOMP if (!is_seccomp_available()) return; if (getpwnam("nobody")) diff --git a/src/test/test-nss.c b/src/test/test-nss.c index 44570caa6c0..0fc30718d5a 100644 --- a/src/test/test-nss.c +++ b/src/test/test-nss.c @@ -450,13 +450,13 @@ static int parse_argv(int argc, char **argv, modules = strv_new(argv[1], NULL); else modules = strv_new( -#ifdef HAVE_MYHOSTNAME +#if HAVE_MYHOSTNAME "myhostname", #endif -#ifdef HAVE_RESOLVED +#if HAVE_RESOLVED "resolve", #endif -#ifdef HAVE_MACHINED +#if HAVE_MACHINED "mymachines", #endif "dns", diff --git a/src/test/test-process-util.c b/src/test/test-process-util.c index e7c9766c44f..0f0e2cbcb9f 100644 --- a/src/test/test-process-util.c +++ b/src/test/test-process-util.c @@ -26,7 +26,7 @@ #include #include #include -#ifdef HAVE_VALGRIND_VALGRIND_H +#if HAVE_VALGRIND_VALGRIND_H #include #endif @@ -168,7 +168,7 @@ static void test_get_process_cmdline_harder(void) { if (geteuid() != 0) return; -#ifdef HAVE_VALGRIND_VALGRIND_H +#if HAVE_VALGRIND_VALGRIND_H /* valgrind patches open(/proc//cmdline) * so, test_get_process_cmdline_harder fails always * See https://github.com/systemd/systemd/pull/3555#issuecomment-226564908 */ @@ -367,7 +367,7 @@ static void test_rename_process_now(const char *p, int ret) { if (r < 0) return; -#ifdef HAVE_VALGRIND_VALGRIND_H +#if HAVE_VALGRIND_VALGRIND_H /* see above, valgrind is weird, we can't verify what we are doing here */ if (RUNNING_ON_VALGRIND) return; diff --git a/src/test/test-sigbus.c b/src/test/test-sigbus.c index 7a4a8a6636c..bcc08b226c8 100644 --- a/src/test/test-sigbus.c +++ b/src/test/test-sigbus.c @@ -22,7 +22,7 @@ #include "fd-util.h" #include "sigbus.h" #include "util.h" -#ifdef HAVE_VALGRIND_VALGRIND_H +#if HAVE_VALGRIND_VALGRIND_H #include #endif @@ -32,7 +32,7 @@ int main(int argc, char *argv[]) { void *addr = NULL; uint8_t *p; -#ifdef HAVE_VALGRIND_VALGRIND_H +#if HAVE_VALGRIND_VALGRIND_H if (RUNNING_ON_VALGRIND) return EXIT_TEST_SKIP; #endif diff --git a/src/timedate/meson.build b/src/timedate/meson.build index 63124d665bb..ce92a6be692 100644 --- a/src/timedate/meson.build +++ b/src/timedate/meson.build @@ -1,4 +1,4 @@ -if conf.get('ENABLE_TIMEDATED', false) +if conf.get('ENABLE_TIMEDATED') == 1 install_data('org.freedesktop.timedate1.conf', install_dir : dbuspolicydir) install_data('org.freedesktop.timedate1.service', diff --git a/src/timesync/meson.build b/src/timesync/meson.build index 4391afa93ac..690af9552c3 100644 --- a/src/timesync/meson.build +++ b/src/timesync/meson.build @@ -16,7 +16,7 @@ timesyncd_gperf_c = custom_target( systemd_timesyncd_sources += [timesyncd_gperf_c] -if conf.get('ENABLE_TIMESYNCD', false) +if conf.get('ENABLE_TIMESYNCD') == 1 timesyncd_conf = configure_file( input : 'timesyncd.conf.in', output : 'timesyncd.conf', diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c index 3f5c1e62ee6..a3df548002a 100644 --- a/src/tmpfiles/tmpfiles.c +++ b/src/tmpfiles/tmpfiles.c @@ -116,7 +116,7 @@ typedef struct Item { char *path; char *argument; char **xattrs; -#ifdef HAVE_ACL +#if HAVE_ACL acl_t acl_access; acl_t acl_default; #endif @@ -744,7 +744,7 @@ static int path_set_xattrs(Item *i, const char *path) { } static int parse_acls_from_arg(Item *item) { -#ifdef HAVE_ACL +#if HAVE_ACL int r; assert(item); @@ -762,7 +762,7 @@ static int parse_acls_from_arg(Item *item) { return 0; } -#ifdef HAVE_ACL +#if HAVE_ACL static int path_set_acl(const char *path, const char *pretty, acl_type_t type, acl_t acl, bool modify) { _cleanup_(acl_free_charpp) char *t = NULL; _cleanup_(acl_freep) acl_t dup = NULL; @@ -810,7 +810,7 @@ static int path_set_acl(const char *path, const char *pretty, acl_type_t type, a static int path_set_acls(Item *item, const char *path) { int r = 0; -#ifdef HAVE_ACL +#if HAVE_ACL char fn[strlen("/proc/self/fd/") + DECIMAL_STR_MAX(int)]; _cleanup_close_ int fd = -1; struct stat st; @@ -1698,7 +1698,7 @@ static void item_free_contents(Item *i) { free(i->argument); strv_free(i->xattrs); -#ifdef HAVE_ACL +#if HAVE_ACL acl_free(i->acl_access); acl_free(i->acl_default); #endif diff --git a/src/udev/meson.build b/src/udev/meson.build index eeb341f8d16..dd24b7e9f78 100644 --- a/src/udev/meson.build +++ b/src/udev/meson.build @@ -36,15 +36,15 @@ libudev_core_sources = ''' net/ethtool-util.h '''.split() -if conf.get('HAVE_KMOD', false) +if conf.get('HAVE_KMOD') == 1 libudev_core_sources += ['udev-builtin-kmod.c'] endif -if conf.get('HAVE_BLKID', false) +if conf.get('HAVE_BLKID') == 1 libudev_core_sources += ['udev-builtin-blkid.c'] endif -if conf.get('HAVE_ACL', false) +if conf.get('HAVE_ACL') == 1 libudev_core_sources += ['udev-builtin-uaccess.c', logind_acl_c, sd_login_c] diff --git a/src/udev/net/link-config.c b/src/udev/net/link-config.c index 6ece1250f25..a5f3b1a1b0f 100644 --- a/src/udev/net/link-config.c +++ b/src/udev/net/link-config.c @@ -58,7 +58,7 @@ static const char* const link_dirs[] = { "/etc/systemd/network", "/run/systemd/network", "/usr/lib/systemd/network", -#ifdef HAVE_SPLIT_USR +#if HAVE_SPLIT_USR "/lib/systemd/network", #endif NULL}; diff --git a/src/udev/udev-builtin-blkid.c b/src/udev/udev-builtin-blkid.c index 11d7085153f..4487e826932 100644 --- a/src/udev/udev-builtin-blkid.c +++ b/src/udev/udev-builtin-blkid.c @@ -107,7 +107,7 @@ static void print_property(struct udev_device *dev, bool test, const char *name, static int find_gpt_root(struct udev_device *dev, blkid_probe pr, bool test) { -#if defined(GPT_ROOT_NATIVE) && defined(ENABLE_EFI) +#if defined(GPT_ROOT_NATIVE) && ENABLE_EFI _cleanup_free_ char *root_id = NULL; bool found_esp = false; diff --git a/src/udev/udev-builtin-btrfs.c b/src/udev/udev-builtin-btrfs.c index cfaa4638044..4d59cc82a8b 100644 --- a/src/udev/udev-builtin-btrfs.c +++ b/src/udev/udev-builtin-btrfs.c @@ -21,7 +21,7 @@ #include #include -#ifdef HAVE_LINUX_BTRFS_H +#if HAVE_LINUX_BTRFS_H #include #endif diff --git a/src/udev/udev-builtin.c b/src/udev/udev-builtin.c index e6b36f124fd..e4dccd0b099 100644 --- a/src/udev/udev-builtin.c +++ b/src/udev/udev-builtin.c @@ -27,21 +27,21 @@ static bool initialized; static const struct udev_builtin *builtins[] = { -#ifdef HAVE_BLKID +#if HAVE_BLKID [UDEV_BUILTIN_BLKID] = &udev_builtin_blkid, #endif [UDEV_BUILTIN_BTRFS] = &udev_builtin_btrfs, [UDEV_BUILTIN_HWDB] = &udev_builtin_hwdb, [UDEV_BUILTIN_INPUT_ID] = &udev_builtin_input_id, [UDEV_BUILTIN_KEYBOARD] = &udev_builtin_keyboard, -#ifdef HAVE_KMOD +#if HAVE_KMOD [UDEV_BUILTIN_KMOD] = &udev_builtin_kmod, #endif [UDEV_BUILTIN_NET_ID] = &udev_builtin_net_id, [UDEV_BUILTIN_NET_LINK] = &udev_builtin_net_setup_link, [UDEV_BUILTIN_PATH_ID] = &udev_builtin_path_id, [UDEV_BUILTIN_USB_ID] = &udev_builtin_usb_id, -#ifdef HAVE_ACL +#if HAVE_ACL [UDEV_BUILTIN_UACCESS] = &udev_builtin_uaccess, #endif }; diff --git a/src/udev/udev.h b/src/udev/udev.h index c0cb7eae84e..2204db5a95b 100644 --- a/src/udev/udev.h +++ b/src/udev/udev.h @@ -146,21 +146,21 @@ int udev_ctrl_get_set_children_max(struct udev_ctrl_msg *ctrl_msg); /* built-in commands */ enum udev_builtin_cmd { -#ifdef HAVE_BLKID +#if HAVE_BLKID UDEV_BUILTIN_BLKID, #endif UDEV_BUILTIN_BTRFS, UDEV_BUILTIN_HWDB, UDEV_BUILTIN_INPUT_ID, UDEV_BUILTIN_KEYBOARD, -#ifdef HAVE_KMOD +#if HAVE_KMOD UDEV_BUILTIN_KMOD, #endif UDEV_BUILTIN_NET_ID, UDEV_BUILTIN_NET_LINK, UDEV_BUILTIN_PATH_ID, UDEV_BUILTIN_USB_ID, -#ifdef HAVE_ACL +#if HAVE_ACL UDEV_BUILTIN_UACCESS, #endif UDEV_BUILTIN_MAX @@ -174,14 +174,14 @@ struct udev_builtin { bool (*validate)(struct udev *udev); bool run_once; }; -#ifdef HAVE_BLKID +#if HAVE_BLKID extern const struct udev_builtin udev_builtin_blkid; #endif extern const struct udev_builtin udev_builtin_btrfs; extern const struct udev_builtin udev_builtin_hwdb; extern const struct udev_builtin udev_builtin_input_id; extern const struct udev_builtin udev_builtin_keyboard; -#ifdef HAVE_KMOD +#if HAVE_KMOD extern const struct udev_builtin udev_builtin_kmod; #endif extern const struct udev_builtin udev_builtin_net_id; diff --git a/src/update-utmp/update-utmp.c b/src/update-utmp/update-utmp.c index f68d60a134a..29facfded05 100644 --- a/src/update-utmp/update-utmp.c +++ b/src/update-utmp/update-utmp.c @@ -21,7 +21,7 @@ #include #include -#ifdef HAVE_AUDIT +#if HAVE_AUDIT #include #endif @@ -42,7 +42,7 @@ typedef struct Context { sd_bus *bus; -#ifdef HAVE_AUDIT +#if HAVE_AUDIT int audit_fd; #endif } Context; @@ -125,7 +125,7 @@ static int on_reboot(Context *c) { /* We finished start-up, so let's write the utmp * record and send the audit msg */ -#ifdef HAVE_AUDIT +#if HAVE_AUDIT if (c->audit_fd >= 0) if (audit_log_user_comm_message(c->audit_fd, AUDIT_SYSTEM_BOOT, "", "systemd-update-utmp", NULL, NULL, NULL, 1) < 0 && errno != EPERM) { @@ -154,7 +154,7 @@ static int on_shutdown(Context *c) { /* We started shut-down, so let's write the utmp * record and send the audit msg */ -#ifdef HAVE_AUDIT +#if HAVE_AUDIT if (c->audit_fd >= 0) if (audit_log_user_comm_message(c->audit_fd, AUDIT_SYSTEM_SHUTDOWN, "", "systemd-update-utmp", NULL, NULL, NULL, 1) < 0 && errno != EPERM) { @@ -198,7 +198,7 @@ static int on_runlevel(Context *c) { if (previous == runlevel) return 0; -#ifdef HAVE_AUDIT +#if HAVE_AUDIT if (c->audit_fd >= 0) { _cleanup_free_ char *s = NULL; @@ -223,7 +223,7 @@ static int on_runlevel(Context *c) { int main(int argc, char *argv[]) { Context c = { -#ifdef HAVE_AUDIT +#if HAVE_AUDIT .audit_fd = -1 #endif }; @@ -245,7 +245,7 @@ int main(int argc, char *argv[]) { umask(0022); -#ifdef HAVE_AUDIT +#if HAVE_AUDIT /* If the kernel lacks netlink or audit support, * don't worry about it. */ c.audit_fd = audit_open(); @@ -275,7 +275,7 @@ int main(int argc, char *argv[]) { log_debug("systemd-update-utmp stopped as pid "PID_FMT, getpid_cached()); finish: -#ifdef HAVE_AUDIT +#if HAVE_AUDIT if (c.audit_fd >= 0) audit_close(c.audit_fd); #endif diff --git a/src/vconsole/meson.build b/src/vconsole/meson.build index 1260b535378..120057cec1b 100644 --- a/src/vconsole/meson.build +++ b/src/vconsole/meson.build @@ -1,4 +1,4 @@ -if conf.get('ENABLE_VCONSOLE', false) +if conf.get('ENABLE_VCONSOLE') == 1 vconsole_rules = configure_file( input : '90-vconsole.rules.in', output : '90-vconsole.rules', diff --git a/sysctl.d/meson.build b/sysctl.d/meson.build index 1b6707df774..121874c7d27 100644 --- a/sysctl.d/meson.build +++ b/sysctl.d/meson.build @@ -4,7 +4,7 @@ install_data( in_files = [] -if conf.get('ENABLE_COREDUMP', false) +if conf.get('ENABLE_COREDUMP') == 1 in_files += ['50-coredump.conf'] endif diff --git a/sysusers.d/meson.build b/sysusers.d/meson.build index b7c02cf8828..2f3f3ebd998 100644 --- a/sysusers.d/meson.build +++ b/sysusers.d/meson.build @@ -1,6 +1,6 @@ in_files = ['basic.conf'] -enable_sysusers = conf.get('ENABLE_SYSUSERS', false) +enable_sysusers = conf.get('ENABLE_SYSUSERS') == 1 foreach file : in_files gen = configure_file( @@ -15,7 +15,7 @@ endforeach m4_files = ['systemd.conf'] -if conf.get('ENABLE_REMOTE', false) and conf.get('HAVE_MICROHTTPD', false) +if conf.get('ENABLE_REMOTE') == 1 and conf.get('HAVE_MICROHTTPD') == 1 m4_files += ['systemd-remote.conf'] endif diff --git a/test/meson.build b/test/meson.build index 991d3fcc925..236dbb04c35 100644 --- a/test/meson.build +++ b/test/meson.build @@ -133,7 +133,7 @@ test_data_files = ''' journal-data/journal-2.txt '''.split() -if conf.get('ENABLE_RESOLVED', false) +if conf.get('ENABLE_RESOLVED') == 1 test_data_files += ''' test-resolve/_openpgpkey.fedoraproject.org.pkts test-resolve/fedoraproject.org.pkts diff --git a/tmpfiles.d/meson.build b/tmpfiles.d/meson.build index 7d21c64708a..9a594a289a4 100644 --- a/tmpfiles.d/meson.build +++ b/tmpfiles.d/meson.build @@ -1,4 +1,4 @@ -enable_tmpfiles = conf.get('ENABLE_TMPFILES', false) +enable_tmpfiles = conf.get('ENABLE_TMPFILES') == 1 tmpfiles = [['home.conf', ''], ['journal-nocow.conf', ''], @@ -12,7 +12,7 @@ tmpfiles = [['home.conf', ''], foreach pair : tmpfiles if not enable_tmpfiles # do nothing - elif pair[1] == '' or conf.get(pair[1], false) + elif pair[1] == '' or conf.get(pair[1]) == 1 install_data(pair[0], install_dir : tmpfilesdir) else message('Not installing tmpfiles.d/@0@ because @1@ is @2@' @@ -28,7 +28,7 @@ m4_files = [['etc.conf', ''], foreach pair : m4_files if not enable_tmpfiles # do nothing - elif pair[1] == '' or conf.get(pair[1], false) + elif pair[1] == '' or conf.get(pair[1]) == 1 custom_target( 'tmpfiles.d_' + pair[0], input : pair[0] + '.m4', diff --git a/units/meson.build b/units/meson.build index 2024d0bfa1a..f8ffe3fc45b 100644 --- a/units/meson.build +++ b/units/meson.build @@ -244,8 +244,8 @@ foreach tuple : in_units # we do this here because install_data does not accept custom_target output conds = tuple[1].split(' ') - install = ((conds.get(0, '') == '' or conf.get(conds[0], false)) and - (conds.get(1, '') == '' or conf.get(conds[1], false))) + install = ((conds.get(0, '') == '' or conf.get(conds[0]) == 1) and + (conds.get(1, '') == '' or conf.get(conds[1]) == 1)) gen1 = configure_file( input : file + '.in', @@ -273,8 +273,8 @@ foreach tuple : m4_units # we do this here because install_data does not accept custom_target output conds = tuple[1].split(' ') - install = ((conds.get(0, '') == '' or conf.get(conds[0], false)) and - (conds.get(1, '') == '' or conf.get(conds[1], false))) + install = ((conds.get(0, '') == '' or conf.get(conds[0]) == 1) and + (conds.get(1, '') == '' or conf.get(conds[1]) == 1)) custom_target( file, @@ -297,8 +297,8 @@ foreach tuple : units input = tuple.get(3, file) conds = tuple[1].split(' ') - install = ((conds.get(0, '') == '' or conf.get(conds[0], false)) and - (conds.get(1, '') == '' or conf.get(conds[1], false))) + install = ((conds.get(0, '') == '' or conf.get(conds[0]) == 1) and + (conds.get(1, '') == '' or conf.get(conds[1]) == 1)) if install install_data(input, @@ -321,7 +321,7 @@ meson.add_install_script(meson_make_symlink, meson.add_install_script(meson_make_symlink, join_paths(dbussystemservicedir, 'org.freedesktop.systemd1.service'), join_paths(dbussessionservicedir, 'org.freedesktop.systemd1.service')) -if conf.get('HAVE_SYSV_COMPAT', false) +if conf.get('HAVE_SYSV_COMPAT') == 1 foreach i : [1, 2, 3, 4, 5] meson.add_install_script( 'sh', '-c', -- 2.39.2