summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2017-10-03 10:41:51 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2017-10-04 12:09:29 +0200
commit349cc4a507c4d84fcadf61f42159ea6412717896 (patch)
tree8d6e64af681fb4e1e41a1fc01b4f225f56aa147d /src
parentaf8786b16a39fbc92818444aac156ccbb030018c (diff)
downloadsystemd-349cc4a507c4d84fcadf61f42159ea6412717896.tar.gz
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
Diffstat (limited to 'src')
-rw-r--r--src/analyze/analyze.c4
-rw-r--r--src/basic/blkid-util.h4
-rw-r--r--src/basic/btrfs-util.c2
-rw-r--r--src/basic/build.h40
-rw-r--r--src/basic/def.h4
-rw-r--r--src/basic/hashmap.c22
-rw-r--r--src/basic/hashmap.h4
-rw-r--r--src/basic/memfd-util.c2
-rw-r--r--src/basic/missing.h22
-rw-r--r--src/basic/path-util.h2
-rw-r--r--src/basic/process-util.c4
-rw-r--r--src/basic/random-util.c8
-rw-r--r--src/basic/selinux-util.c34
-rw-r--r--src/basic/smack-util.c2
-rw-r--r--src/basic/socket-util.c2
-rw-r--r--src/boot/efi/boot.c2
-rw-r--r--src/boot/efi/measure.c2
-rw-r--r--src/boot/efi/meson.build4
-rw-r--r--src/boot/efi/stub.c2
-rw-r--r--src/core/audit-fd.c2
-rw-r--r--src/core/dbus-execute.c14
-rw-r--r--src/core/dbus.c4
-rw-r--r--src/core/execute.c48
-rw-r--r--src/core/ima-setup.c2
-rw-r--r--src/core/kmod-setup.c8
-rw-r--r--src/core/load-fragment.c16
-rw-r--r--src/core/main.c14
-rw-r--r--src/core/manager.c6
-rw-r--r--src/core/mount-setup.c12
-rw-r--r--src/core/namespace.c2
-rw-r--r--src/core/selinux-access.c6
-rw-r--r--src/core/selinux-access.h2
-rw-r--r--src/core/selinux-setup.c6
-rw-r--r--src/core/smack-setup.c4
-rw-r--r--src/core/umount.c2
-rw-r--r--src/coredump/coredump.c8
-rw-r--r--src/coredump/coredumpctl.c2
-rw-r--r--src/coredump/meson.build2
-rw-r--r--src/delta/delta.c4
-rw-r--r--src/fsck/fsck.c4
-rw-r--r--src/gpt-auto-generator/gpt-auto-generator.c6
-rw-r--r--src/hostname/meson.build2
-rw-r--r--src/import/meson.build2
-rw-r--r--src/journal-remote/journal-gatewayd.c2
-rw-r--r--src/journal-remote/journal-remote.c4
-rw-r--r--src/journal-remote/meson.build4
-rw-r--r--src/journal-remote/microhttpd-util.c4
-rw-r--r--src/journal/audit-type.c2
-rw-r--r--src/journal/compress.c26
-rw-r--r--src/journal/compress.h4
-rw-r--r--src/journal/journal-def.h8
-rw-r--r--src/journal/journal-file.c36
-rw-r--r--src/journal/journal-file.h6
-rw-r--r--src/journal/journal-verify.c6
-rw-r--r--src/journal/journalctl.c14
-rw-r--r--src/journal/journald-context.c4
-rw-r--r--src/journal/journald-native.c2
-rw-r--r--src/journal/journald-server.c8
-rw-r--r--src/journal/journald-stream.c2
-rw-r--r--src/journal/journald-syslog.c2
-rw-r--r--src/journal/journald.c2
-rw-r--r--src/journal/meson.build6
-rw-r--r--src/journal/mmap-cache.c4
-rw-r--r--src/journal/sd-journal.c4
-rw-r--r--src/journal/test-compress-benchmark.c8
-rw-r--r--src/journal/test-compress.c16
-rw-r--r--src/journal/test-journal.c2
-rw-r--r--src/libsystemd/sd-bus/bus-control.c2
-rw-r--r--src/libsystemd/sd-bus/bus-kernel.c2
-rw-r--r--src/libsystemd/sd-bus/test-bus-gvariant.c6
-rw-r--r--src/libsystemd/sd-bus/test-bus-marshal.c8
-rw-r--r--src/libsystemd/sd-hwdb/sd-hwdb.c2
-rw-r--r--src/libsystemd/sd-path/sd-path.c6
-rw-r--r--src/locale/localed.c4
-rw-r--r--src/locale/meson.build4
-rw-r--r--src/login/logind-acl.h2
-rw-r--r--src/login/meson.build4
-rw-r--r--src/machine/meson.build2
-rw-r--r--src/network/meson.build2
-rw-r--r--src/network/networkd-manager.c2
-rw-r--r--src/nspawn/nspawn-mount.c4
-rw-r--r--src/nspawn/nspawn-patch-uid.c4
-rw-r--r--src/nspawn/nspawn-seccomp.c6
-rw-r--r--src/nspawn/nspawn.c10
-rw-r--r--src/quotacheck/quotacheck.c4
-rw-r--r--src/resolve/meson.build2
-rw-r--r--src/resolve/resolved-conf.c2
-rw-r--r--src/resolve/resolved-dns-dnssec.c4
-rw-r--r--src/resolve/resolved-link.c2
-rw-r--r--src/resolve/resolved-manager.c10
-rw-r--r--src/resolve/test-dnssec-complex.c2
-rw-r--r--src/resolve/test-dnssec.c4
-rw-r--r--src/shared/acl-util.h2
-rw-r--r--src/shared/bus-unit-util.c2
-rw-r--r--src/shared/bus-util.c12
-rw-r--r--src/shared/dissect-image.c22
-rw-r--r--src/shared/dns-domain.c10
-rw-r--r--src/shared/dns-domain.h2
-rw-r--r--src/shared/efivars.c2
-rw-r--r--src/shared/efivars.h2
-rw-r--r--src/shared/firewall-util.h2
-rw-r--r--src/shared/gcrypt-util.c2
-rw-r--r--src/shared/gcrypt-util.h6
-rw-r--r--src/shared/install.c4
-rw-r--r--src/shared/journal-util.c4
-rw-r--r--src/shared/meson.build8
-rw-r--r--src/shared/path-lookup.c2
-rw-r--r--src/shared/spawn-polkit-agent.c2
-rw-r--r--src/shared/utmp-wtmp.h2
-rw-r--r--src/systemctl/systemctl.c18
-rw-r--r--src/sysusers/sysusers.c4
-rw-r--r--src/test/test-dns-domain.c4
-rw-r--r--src/test/test-execute.c10
-rw-r--r--src/test/test-nss.c6
-rw-r--r--src/test/test-process-util.c6
-rw-r--r--src/test/test-sigbus.c4
-rw-r--r--src/timedate/meson.build2
-rw-r--r--src/timesync/meson.build2
-rw-r--r--src/tmpfiles/tmpfiles.c10
-rw-r--r--src/udev/meson.build6
-rw-r--r--src/udev/net/link-config.c2
-rw-r--r--src/udev/udev-builtin-blkid.c2
-rw-r--r--src/udev/udev-builtin-btrfs.c2
-rw-r--r--src/udev/udev-builtin.c6
-rw-r--r--src/udev/udev.h10
-rw-r--r--src/update-utmp/update-utmp.c16
-rw-r--r--src/vconsole/meson.build2
127 files changed, 409 insertions, 409 deletions
diff --git a/src/analyze/analyze.c b/src/analyze/analyze.c
index 0e0fb08922..9fcc20dba3 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 1b9cace040..53340ec6f3 100644
--- a/src/basic/blkid-util.h
+++ b/src/basic/blkid-util.h
@@ -19,13 +19,13 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
-#ifdef HAVE_BLKID
+#if HAVE_BLKID
#include <blkid.h>
#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 5505499312..c2061addd1 100644
--- a/src/basic/btrfs-util.c
+++ b/src/basic/btrfs-util.c
@@ -32,7 +32,7 @@
#include <sys/sysmacros.h>
#include <unistd.h>
-#ifdef HAVE_LINUX_BTRFS_H
+#if HAVE_LINUX_BTRFS_H
#include <linux/btrfs.h>
#endif
diff --git a/src/basic/build.h b/src/basic/build.h
index 3223915da6..8ca8f706cb 100644
--- a/src/basic/build.h
+++ b/src/basic/build.h
@@ -19,121 +19,121 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
-#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 d3f5381e1b..c04e58b57a 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 6ef1b0ba35..289c2ad2c3 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 <pthread.h>
#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 6d1ae48b21..c1089652d3 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 8c8cc78ebf..8f4f0e3a24 100644
--- a/src/basic/memfd-util.c
+++ b/src/basic/memfd-util.c
@@ -21,7 +21,7 @@
#include <fcntl.h>
#include <sys/stat.h>
#include <unistd.h>
-#ifdef HAVE_LINUX_MEMFD_H
+#if HAVE_LINUX_MEMFD_H
#include <linux/memfd.h>
#endif
#include <stdio.h>
diff --git a/src/basic/missing.h b/src/basic/missing.h
index 2523b28fa1..352d2b024b 100644
--- a/src/basic/missing.h
+++ b/src/basic/missing.h
@@ -40,7 +40,7 @@
#include <uchar.h>
#include <unistd.h>
-#ifdef HAVE_AUDIT
+#if HAVE_AUDIT
#include <libaudit.h>
#endif
@@ -48,11 +48,11 @@
#include <asm/sgidefs.h>
#endif
-#ifdef HAVE_LINUX_BTRFS_H
+#if HAVE_LINUX_BTRFS_H
#include <linux/btrfs.h>
#endif
-#ifdef HAVE_LINUX_VM_SOCKETS_H
+#if HAVE_LINUX_VM_SOCKETS_H
#include <linux/vm_sockets.h>
#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 ea00955818..546246595c 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 ab661a8f16..8e94f969c3 100644
--- a/src/basic/process-util.c
+++ b/src/basic/process-util.c
@@ -34,7 +34,7 @@
#include <sys/wait.h>
#include <syslog.h>
#include <unistd.h>
-#ifdef HAVE_VALGRIND_VALGRIND_H
+#if HAVE_VALGRIND_VALGRIND_H
#include <valgrind/valgrind.h>
#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 42f484d687..146c8f55ed 100644
--- a/src/basic/random-util.c
+++ b/src/basic/random-util.c
@@ -26,11 +26,11 @@
#include <linux/random.h>
#include <stdint.h>
-#ifdef HAVE_SYS_AUXV_H
+#if HAVE_SYS_AUXV_H
# include <sys/auxv.h>
#endif
-#ifdef USE_SYS_RANDOM_H
+#if USE_SYS_RANDOM_H
# include <sys/random.h>
#else
# include <linux/random.h>
@@ -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 139e6e21e3..93bcdb2160 100644
--- a/src/basic/selinux-util.c
+++ b/src/basic/selinux-util.c
@@ -26,7 +26,7 @@
#include <sys/un.h>
#include <syslog.h>
-#ifdef HAVE_SELINUX
+#if HAVE_SELINUX
#include <selinux/context.h>
#include <selinux/label.h>
#include <selinux/selinux.h>
@@ -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 3a3df987df..e80327c200 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 e8d39674cc..6af027e02d 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 21898837e0..12176f1fe0 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 8627c09077..324d1c8b9e 100644
--- a/src/boot/efi/measure.c
+++ b/src/boot/efi/measure.c
@@ -11,7 +11,7 @@
*
*/
-#ifdef ENABLE_TPM
+#if ENABLE_TPM
#include <efi.h>
#include <efilib.h>
diff --git a/src/boot/efi/meson.build b/src/boot/efi/meson.build
index b111aad852..eb0be02977 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 7d03370cbd..e85ebf2c3f 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 bc421a4343..6207f8185e 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 <libaudit.h>
#include <stdbool.h>
diff --git a/src/core/dbus-execute.c b/src/core/dbus-execute.c
index 1a388f5592..e0aa9fdd82 100644
--- a/src/core/dbus-execute.c
+++ b/src/core/dbus-execute.c
@@ -19,7 +19,7 @@
#include <sys/prctl.h>
-#ifdef HAVE_SECCOMP
+#if HAVE_SECCOMP
#include <seccomp.h>
#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 6d3f714192..210b344cd3 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 e1c2a57cc6..2271a2876a 100644
--- a/src/core/execute.c
+++ b/src/core/execute.c
@@ -37,19 +37,19 @@
#include <unistd.h>
#include <utmpx.h>
-#ifdef HAVE_PAM
+#if HAVE_PAM
#include <security/pam_appl.h>
#endif
-#ifdef HAVE_SELINUX
+#if HAVE_SELINUX
#include <selinux/selinux.h>
#endif
-#ifdef HAVE_SECCOMP
+#if HAVE_SECCOMP
#include <seccomp.h>
#endif
-#ifdef HAVE_APPARMOR
+#if HAVE_APPARMOR
#include <sys/apparmor.h>
#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 7b5c98a57c..1aaae9f49e 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 30b42fffe5..066b959770 100644
--- a/src/core/kmod-setup.c
+++ b/src/core/kmod-setup.c
@@ -21,7 +21,7 @@
#include <string.h>
#include <unistd.h>
-#ifdef HAVE_KMOD
+#if HAVE_KMOD
#include <libkmod.h>
#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 2c3783a9f0..04170695c5 100644
--- a/src/core/load-fragment.c
+++ b/src/core/load-fragment.c
@@ -22,7 +22,7 @@
#include <fcntl.h>
#include <linux/fs.h>
#include <linux/oom.h>
-#ifdef HAVE_SECCOMP
+#if HAVE_SECCOMP
#include <seccomp.h>
#endif
#include <sched.h>
@@ -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 2dfd48005b..60863d2eed 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -28,10 +28,10 @@
#include <sys/reboot.h>
#include <sys/stat.h>
#include <unistd.h>
-#ifdef HAVE_SECCOMP
+#if HAVE_SECCOMP
#include <seccomp.h>
#endif
-#ifdef HAVE_VALGRIND_VALGRIND_H
+#if HAVE_VALGRIND_VALGRIND_H
#include <valgrind/valgrind.h>
#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 5c127e0848..a0d3c85ff1 100644
--- a/src/core/manager.c
+++ b/src/core/manager.c
@@ -30,7 +30,7 @@
#include <sys/wait.h>
#include <unistd.h>
-#ifdef HAVE_AUDIT
+#if HAVE_AUDIT
#include <libaudit.h>
#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 b343bb7e09..676c82dcc9 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 932fbe5c54..6d74b8da67 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 0f8a2d68e2..2db4189401 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 <errno.h>
#include <selinux/avc.h>
#include <selinux/selinux.h>
#include <stdio.h>
-#ifdef HAVE_AUDIT
+#if HAVE_AUDIT
#include <libaudit.h>
#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 f46370d020..1f6a518a61 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 527aa8add0..60361a5638 100644
--- a/src/core/selinux-setup.c
+++ b/src/core/selinux-setup.c
@@ -21,7 +21,7 @@
#include <stdio.h>
#include <unistd.h>
-#ifdef HAVE_SELINUX
+#if HAVE_SELINUX
#include <selinux/selinux.h>
#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 9f25364335..be32c43423 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 7e9ea20388..813d257139 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 96a4d400f8..300d647903 100644
--- a/src/coredump/coredump.c
+++ b/src/coredump/coredump.c
@@ -23,7 +23,7 @@
#include <sys/xattr.h>
#include <unistd.h>
-#ifdef HAVE_ELFUTILS
+#if HAVE_ELFUTILS
#include <dwarf.h>
#include <elfutils/libdwfl.h>
#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 114a13fc78..0380df10d1 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 8f7d898b62..25a0409046 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 b0689ffff7..605bea57bb 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 434321f806..cd39161f10 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 bf28af0a6f..ae0a8da63a 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 d58caa6787..834300ae6e 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 3fd58cc2c8..e3a0da65d2 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 63261bfa6c..a0f1f3e926 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 64b1105901..9f51137645 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 d266b34e65..ed963d7930 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 f5d2d7967a..75c14ec996 100644
--- a/src/journal-remote/microhttpd-util.c
+++ b/src/journal-remote/microhttpd-util.c
@@ -22,7 +22,7 @@
#include <stdio.h>
#include <string.h>
-#ifdef HAVE_GNUTLS
+#if HAVE_GNUTLS
#include <gnutls/gnutls.h>
#include <gnutls/x509.h>
#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 71e8790ca8..373d3455ae 100644
--- a/src/journal/audit-type.c
+++ b/src/journal/audit-type.c
@@ -19,7 +19,7 @@
#include <stdio.h>
#include <linux/audit.h>
-#ifdef HAVE_AUDIT
+#if HAVE_AUDIT
# include <libaudit.h>
#endif
diff --git a/src/journal/compress.c b/src/journal/compress.c
index 818a720ba8..3124d1210e 100644
--- a/src/journal/compress.c
+++ b/src/journal/compress.c
@@ -23,11 +23,11 @@
#include <sys/mman.h>
#include <unistd.h>
-#ifdef HAVE_XZ
+#if HAVE_XZ
#include <lzma.h>
#endif
-#ifdef HAVE_LZ4
+#if HAVE_LZ4
#include <lz4.h>
#include <lz4frame.h>
#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 c138099d9a..fb71662a99 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 67edb43960..1bd5de4c43 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 ec66f4d5a4..3027801ab1 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 df457c9a81..008dba604b 100644
--- a/src/journal/journal-file.h
+++ b/src/journal/journal-file.h
@@ -21,7 +21,7 @@
#include <inttypes.h>
-#ifdef HAVE_GCRYPT
+#if HAVE_GCRYPT
#include <gcrypt.h>
#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 0904b758c8..e756f51d0f 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 3dcfb0e97a..61814a0cbb 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 10e9615f23..eaa7f2544f 100644
--- a/src/journal/journald-context.c
+++ b/src/journal/journald-context.c
@@ -17,7 +17,7 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
-#ifdef HAVE_SELINUX
+#if HAVE_SELINUX
#include <selinux/selinux.h>
#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 554f91460d..e359bcf714 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 de643c9149..db6ca37d79 100644
--- a/src/journal/journald-server.c
+++ b/src/journal/journald-server.c
@@ -17,7 +17,7 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
-#ifdef HAVE_SELINUX
+#if HAVE_SELINUX
#include <selinux/selinux.h>
#endif
#include <sys/ioctl.h>
@@ -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 d0b95ea02c..54dd096e45 100644
--- a/src/journal/journald-stream.c
+++ b/src/journal/journald-stream.c
@@ -20,7 +20,7 @@
#include <stddef.h>
#include <unistd.h>
-#ifdef HAVE_SELINUX
+#if HAVE_SELINUX
#include <selinux/selinux.h>
#endif
diff --git a/src/journal/journald-syslog.c b/src/journal/journald-syslog.c
index 7d040de893..1fde0271a6 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 4dee764fdd..318e067563 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 b95efc2041..da42fd89d2 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 6e60d24dcf..ac7252093b 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 fb7269e510..40805eb2b8 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 7bddd178c4..be5a6655a8 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 92108a84b3..6948e8ccbe 100644
--- a/src/journal/test-compress.c
+++ b/src/journal/test-compress.c
@@ -17,7 +17,7 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
-#ifdef HAVE_LZ4
+#if HAVE_LZ4
#include <lz4.h>
#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 2543d64b5b..df685e90b6 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 3c770a6e2e..fcd4d27e07 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 <http://www.gnu.org/licenses/>.
***/
-#ifdef HAVE_VALGRIND_MEMCHECK_H
+#if HAVE_VALGRIND_MEMCHECK_H
#include <valgrind/memcheck.h>
#endif
diff --git a/src/libsystemd/sd-bus/bus-kernel.c b/src/libsystemd/sd-bus/bus-kernel.c
index 9b1dad9cfc..5a3c4d6f50 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 <http://www.gnu.org/licenses/>.
***/
-#ifdef HAVE_VALGRIND_MEMCHECK_H
+#if HAVE_VALGRIND_MEMCHECK_H
#include <valgrind/memcheck.h>
#endif
diff --git a/src/libsystemd/sd-bus/test-bus-gvariant.c b/src/libsystemd/sd-bus/test-bus-gvariant.c
index e8301f9556..94fa964595 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 <http://www.gnu.org/licenses/>.
***/
-#ifdef HAVE_GLIB
+#if HAVE_GLIB
#include <glib.h>
#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 e60c30b1b4..221dbd35cc 100644
--- a/src/libsystemd/sd-bus/test-bus-marshal.c
+++ b/src/libsystemd/sd-bus/test-bus-marshal.c
@@ -20,11 +20,11 @@
#include <math.h>
#include <stdlib.h>
-#ifdef HAVE_GLIB
+#if HAVE_GLIB
#include <gio/gio.h>
#endif
-#ifdef HAVE_DBUS
+#if HAVE_DBUS
#include <dbus/dbus.h>
#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 c155c70162..f8246eaa70 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 6e41dac1ad..6570d01392 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 b4798d674c..3c0c167dcf 100644
--- a/src/locale/localed.c
+++ b/src/locale/localed.c
@@ -22,7 +22,7 @@
#include <string.h>
#include <unistd.h>
-#ifdef HAVE_XKBCOMMON
+#if HAVE_XKBCOMMON
#include <xkbcommon/xkbcommon.h>
#include <dlfcn.h>
#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 d7dd113c8d..e9de6089f3 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 1286c6a3cd..606005a6f1 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 26bdbec424..d0723f134f 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 1a0813323c..693503da53 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 83a837d6c9..38c2220e8b 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 1e82c87d36..71445d5dda 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 e80c944e9f..531f29cb7b 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 f861db879a..063fdb1053 100644
--- a/src/nspawn/nspawn-patch-uid.c
+++ b/src/nspawn/nspawn-patch-uid.c
@@ -19,7 +19,7 @@
#include <fcntl.h>
#include <linux/magic.h>
-#ifdef HAVE_ACL
+#if HAVE_ACL
#include <sys/acl.h>
#endif
#include <sys/stat.h>
@@ -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 38c2b12e95..196766dc98 100644
--- a/src/nspawn/nspawn-seccomp.c
+++ b/src/nspawn/nspawn-seccomp.c
@@ -22,20 +22,20 @@
#include <sys/capability.h>
#include <sys/types.h>
-#ifdef HAVE_SECCOMP
+#if HAVE_SECCOMP
#include <seccomp.h>
#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 82fd0bd5f4..4e3803be82 100644
--- a/src/nspawn/nspawn.c
+++ b/src/nspawn/nspawn.c
@@ -17,7 +17,7 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
-#ifdef HAVE_BLKID
+#if HAVE_BLKID
#include <blkid.h>
#endif
#include <errno.h>
@@ -26,7 +26,7 @@
#include <linux/loop.h>
#include <pwd.h>
#include <sched.h>
-#ifdef HAVE_SELINUX
+#if HAVE_SELINUX
#include <selinux/selinux.h>
#endif
#include <signal.h>
@@ -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 a42fce377e..1339564edb 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 fe228784fa..935214d6a5 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 75636e0e56..3cf4261ff0 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 eddab58a81..4f398d8119 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 <http://www.gnu.org/licenses/>.
***/
-#ifdef HAVE_GCRYPT
+#if HAVE_GCRYPT
#include <gcrypt.h>
#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 95795e4d24..21fd8465e6 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 b6620875ea..c8961f20a7 100644
--- a/src/resolve/resolved-manager.c
+++ b/src/resolve/resolved-manager.c
@@ -21,7 +21,7 @@
#include <poll.h>
#include <sys/ioctl.h>
-#ifdef HAVE_LIBIDN2
+#if HAVE_LIBIDN2
#include <idn2.h>
#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 090b2fac23..25ec6f4352 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 b3018e8239..8cb4b50393 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 396e9e067e..a0e31d8e29 100644
--- a/src/shared/acl-util.h
+++ b/src/shared/acl-util.h
@@ -19,7 +19,7 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
-#ifdef HAVE_ACL
+#if HAVE_ACL
#include <acl/libacl.h>
#include <stdbool.h>
diff --git a/src/shared/bus-unit-util.c b/src/shared/bus-unit-util.c
index a08f17d821..e191f8c93e 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 a9a763c1ca..7609d9c522 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 243a46f2e3..dd8650e1a8 100644
--- a/src/shared/dissect-image.c
+++ b/src/shared/dissect-image.c
@@ -17,7 +17,7 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
-#ifdef HAVE_LIBCRYPTSETUP
+#if HAVE_LIBCRYPTSETUP
#include <libcryptsetup.h>
#endif
#include <sys/mount.h>
@@ -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 139d286af8..9804907304 100644
--- a/src/shared/dns-domain.c
+++ b/src/shared/dns-domain.c
@@ -17,9 +17,9 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
-#if defined(HAVE_LIBIDN2)
+#if HAVE_LIBIDN2
# include <idn2.h>
-#elif defined(HAVE_LIBIDN)
+#elif HAVE_LIBIDN
# include <idna.h>
# include <stringprep.h>
#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 fca025def0..a44d9d48d4 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 2503346610..a3850bede2 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 b61d14c4ec..72bace0d07 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 c39b34cf8f..5915266b4b 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 39b544b6f0..e10a38dcfc 100644
--- a/src/shared/gcrypt-util.c
+++ b/src/shared/gcrypt-util.c
@@ -19,7 +19,7 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
-#ifdef HAVE_GCRYPT
+#if HAVE_GCRYPT
#include <gcrypt.h>
#include "gcrypt-util.h"
diff --git a/src/shared/gcrypt-util.h b/src/shared/gcrypt-util.h
index 1da12a32be..f08ed6052c 100644
--- a/src/shared/gcrypt-util.h
+++ b/src/shared/gcrypt-util.h
@@ -23,7 +23,7 @@
#include <stdbool.h>
#include <stddef.h>
-#ifdef HAVE_GCRYPT
+#if HAVE_GCRYPT
#include <gcrypt.h>
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 0a8628c26a..7598bf6a23 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 8479221a44..fff3dfc9d1 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 ce84d007d1..bb9720a94a 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 bf10acda94..68c392e1c0 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 7dae4d14fe..9a40147662 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 438e270a26..8da594100a 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 897fc48b98..17ea5c3a32 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 e9e6dae10c..6f0e83d51e 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 93b758ec7a..75bc5e4a73 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 68166cf749..6786d56197 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 44570caa6c..0fc30718d5 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 e7c9766c44..0f0e2cbcb9 100644
--- a/src/test/test-process-util.c
+++ b/src/test/test-process-util.c
@@ -26,7 +26,7 @@
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
-#ifdef HAVE_VALGRIND_VALGRIND_H
+#if HAVE_VALGRIND_VALGRIND_H
#include <valgrind/valgrind.h>
#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 7a4a8a6636..bcc08b226c 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 <valgrind/valgrind.h>
#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 63124d665b..ce92a6be69 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 4391afa93a..690af9552c 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 3f5c1e62ee..a3df548002 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 eeb341f8d1..dd24b7e9f7 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 6ece1250f2..a5f3b1a1b0 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 11d7085153..4487e82693 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 cfaa463804..4d59cc82a8 100644
--- a/src/udev/udev-builtin-btrfs.c
+++ b/src/udev/udev-builtin-btrfs.c
@@ -21,7 +21,7 @@
#include <stdlib.h>
#include <sys/ioctl.h>
-#ifdef HAVE_LINUX_BTRFS_H
+#if HAVE_LINUX_BTRFS_H
#include <linux/btrfs.h>
#endif
diff --git a/src/udev/udev-builtin.c b/src/udev/udev-builtin.c
index e6b36f124f..e4dccd0b09 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 c0cb7eae84..2204db5a95 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 f68d60a134..29facfded0 100644
--- a/src/update-utmp/update-utmp.c
+++ b/src/update-utmp/update-utmp.c
@@ -21,7 +21,7 @@
#include <string.h>
#include <unistd.h>
-#ifdef HAVE_AUDIT
+#if HAVE_AUDIT
#include <libaudit.h>
#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 1260b53537..120057cec1 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',