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
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2017-10-03 10:41:51 +02:00
parent af8786b16a
commit 349cc4a507
140 changed files with 598 additions and 565 deletions

View File

@ -3,7 +3,7 @@ file = configure_file(
output : 'README', output : 'README',
configuration : substs) configuration : substs)
if conf.get('HAVE_SYSV_COMPAT', false) if conf.get('HAVE_SYSV_COMPAT') == 1
install_data(file, install_data(file,
install_dir : sysvinit_path) install_dir : sysvinit_path)
endif endif

View File

@ -3,7 +3,7 @@ file = configure_file(
output : 'README', output : 'README',
configuration : substs) configuration : substs)
if conf.get('HAVE_SYSV_COMPAT', false) if conf.get('HAVE_SYSV_COMPAT') == 1
install_data(file, install_data(file,
install_dir : varlogdir) install_dir : varlogdir)
endif endif

View File

@ -18,7 +18,7 @@ hwdb_files = files('''
70-touchpad.hwdb 70-touchpad.hwdb
'''.split()) '''.split())
if conf.get('ENABLE_HWDB', false) if conf.get('ENABLE_HWDB') == 1
install_data(hwdb_files, install_data(hwdb_files,
install_dir : udevhwdbdir) install_dir : udevhwdbdir)

View File

@ -51,7 +51,7 @@ foreach tuple : manpages
mandirn = join_paths(get_option('mandir'), 'man' + section) mandirn = join_paths(get_option('mandir'), 'man' + section)
if condition == '' or conf.get(condition, false) if condition == '' or conf.get(condition) == 1
p1 = custom_target( p1 = custom_target(
man, man,
input : xml, input : xml,

View File

@ -38,8 +38,8 @@ endif
##################################################################### #####################################################################
rootprefixdir = get_option('rootprefix') rootprefixdir = get_option('rootprefix')
conf.set10('HAVE_SPLIT_USR', get_option('split-usr'))
if get_option('split-usr') if get_option('split-usr')
conf.set('HAVE_SPLIT_USR', true)
rootprefixdir = rootprefixdir != '' ? rootprefixdir : '/' rootprefixdir = rootprefixdir != '' ? rootprefixdir : '/'
else else
rootprefixdir = rootprefixdir != '' ? rootprefixdir : '/usr' rootprefixdir = rootprefixdir != '' ? rootprefixdir : '/usr'
@ -47,11 +47,10 @@ endif
sysvinit_path = get_option('sysvinit-path') sysvinit_path = get_option('sysvinit-path')
sysvrcnd_path = get_option('sysvrcnd-path') sysvrcnd_path = get_option('sysvrcnd-path')
if sysvinit_path != '' or sysvrcnd_path != '' have = sysvinit_path != '' or sysvrcnd_path != ''
conf.set('HAVE_SYSV_COMPAT', true, conf.set10('HAVE_SYSV_COMPAT', have,
description : 'SysV init scripts and rcN.d links are supported') description : 'SysV init scripts and rcN.d links are supported')
m4_defines += ['-DHAVE_SYSV_COMPAT'] m4_defines += have ? ['-DHAVE_SYSV_COMPAT'] : []
endif
# join_paths ignore the preceding arguments if an absolute component is # join_paths ignore the preceding arguments if an absolute component is
# encountered, so this should canonicalize various paths when they are # encountered, so this should canonicalize various paths when they are
@ -390,7 +389,7 @@ foreach decl : ['char16_t',
# We get -1 if the size cannot be determined # We get -1 if the size cannot be determined
have = cc.sizeof(decl, prefix : decl_headers) > 0 have = cc.sizeof(decl, prefix : decl_headers) > 0
conf.set('HAVE_' + decl.underscorify().to_upper(), have) conf.set10('HAVE_' + decl.underscorify().to_upper(), have)
endforeach endforeach
foreach decl : [['IFLA_INET6_ADDR_GEN_MODE', 'linux/if_link.h'], foreach decl : [['IFLA_INET6_ADDR_GEN_MODE', 'linux/if_link.h'],
@ -422,12 +421,8 @@ foreach decl : [['IFLA_INET6_ADDR_GEN_MODE', 'linux/if_link.h'],
conf.set10('HAVE_' + decl[0], have) conf.set10('HAVE_' + decl[0], have)
endforeach endforeach
skip = false
foreach ident : ['secure_getenv', '__secure_getenv'] foreach ident : ['secure_getenv', '__secure_getenv']
if not skip and cc.has_function(ident) conf.set10('HAVE_' + ident.to_upper(), cc.has_function(ident))
conf.set('HAVE_' + ident.to_upper(), true)
skip = true
endif
endforeach endforeach
foreach ident : [ foreach ident : [
@ -456,10 +451,11 @@ foreach ident : [
endforeach endforeach
if cc.has_function('getrandom', prefix : '''#include <sys/random.h>''') if cc.has_function('getrandom', prefix : '''#include <sys/random.h>''')
conf.set('USE_SYS_RANDOM_H', true) conf.set10('USE_SYS_RANDOM_H', true)
conf.set10('HAVE_GETRANDOM', true) conf.set10('HAVE_GETRANDOM', true)
else else
have = cc.has_function('getrandom', prefix : '''#include <linux/random.h>''') have = cc.has_function('getrandom', prefix : '''#include <linux/random.h>''')
conf.set10('USE_SYS_RANDOM_H', false)
conf.set10('HAVE_GETRANDOM', have) conf.set10('HAVE_GETRANDOM', have)
endif endif
@ -550,8 +546,8 @@ foreach header : ['linux/btrfs.h',
'valgrind/valgrind.h', 'valgrind/valgrind.h',
] ]
conf.set('HAVE_' + header.underscorify().to_upper(), conf.set10('HAVE_' + header.underscorify().to_upper(),
cc.has_header(header)) cc.has_header(header))
endforeach endforeach
############################################################ ############################################################
@ -638,17 +634,21 @@ substs.set('SUSHELL', get_option('debug-shell'))
substs.set('DEBUGTTY', get_option('debug-tty')) substs.set('DEBUGTTY', get_option('debug-tty'))
debug = get_option('debug') debug = get_option('debug')
enable_debug_hashmap = false
enable_debug_mmap_cache = false
if debug != '' if debug != ''
foreach name : debug.split(',') foreach name : debug.split(',')
if name == 'hashmap' if name == 'hashmap'
conf.set('ENABLE_DEBUG_HASHMAP', true) enable_debug_hashmap = true
elif name == 'mmap-cache' elif name == 'mmap-cache'
conf.set('ENABLE_DEBUG_MMAP_CACHE', true) enable_debug_mmap_cache = true
else else
message('unknown debug option "@0@", ignoring'.format(name)) message('unknown debug option "@0@", ignoring'.format(name))
endif endif
endforeach endforeach
endif endif
conf.set10('ENABLE_DEBUG_HASHMAP', enable_debug_hashmap)
conf.set10('ENABLE_DEBUG_MMAP_CACHE', enable_debug_mmap_cache)
##################################################################### #####################################################################
@ -672,38 +672,38 @@ if want_seccomp != 'false'
libseccomp = dependency('libseccomp', libseccomp = dependency('libseccomp',
version : '>= 2.3.1', version : '>= 2.3.1',
required : want_seccomp == 'true') required : want_seccomp == 'true')
if libseccomp.found() have = libseccomp.found()
conf.set('HAVE_SECCOMP', true)
m4_defines += ['-DHAVE_SECCOMP']
endif
else else
have = false
libseccomp = [] libseccomp = []
endif endif
conf.set10('HAVE_SECCOMP', have)
m4_defines += have ? ['-DHAVE_SECCOMP'] : []
want_selinux = get_option('selinux') want_selinux = get_option('selinux')
if want_selinux != 'false' if want_selinux != 'false'
libselinux = dependency('libselinux', libselinux = dependency('libselinux',
version : '>= 2.1.9', version : '>= 2.1.9',
required : want_selinux == 'true') required : want_selinux == 'true')
if libselinux.found() have = libselinux.found()
conf.set('HAVE_SELINUX', true)
m4_defines += ['-DHAVE_SELINUX']
endif
else else
have = false
libselinux = [] libselinux = []
endif endif
conf.set10('HAVE_SELINUX', have)
m4_defines += have ? ['-DHAVE_SELINUX'] : []
want_apparmor = get_option('apparmor') want_apparmor = get_option('apparmor')
if want_apparmor != 'false' if want_apparmor != 'false'
libapparmor = dependency('libapparmor', libapparmor = dependency('libapparmor',
required : want_apparmor == 'true') required : want_apparmor == 'true')
if libapparmor.found() have = libapparmor.found()
conf.set('HAVE_APPARMOR', true)
m4_defines += ['-DHAVE_APPARMOR']
endif
else else
have = false
libapparmor = [] libapparmor = []
endif endif
conf.set10('HAVE_APPARMOR', have)
m4_defines += have ? ['-DHAVE_APPARMOR'] : []
smack_run_label = get_option('smack-run-label') smack_run_label = get_option('smack-run-label')
if smack_run_label != '' if smack_run_label != ''
@ -715,7 +715,6 @@ want_polkit = get_option('polkit')
install_polkit = false install_polkit = false
install_polkit_pkla = false install_polkit_pkla = false
if want_polkit != 'false' if want_polkit != 'false'
conf.set('ENABLE_POLKIT', true)
install_polkit = true install_polkit = true
libpolkit = dependency('polkit-gobject-1', libpolkit = dependency('polkit-gobject-1',
@ -725,92 +724,101 @@ if want_polkit != 'false'
install_polkit_pkla = true install_polkit_pkla = true
endif endif
endif endif
conf.set10('ENABLE_POLKIT', install_polkit)
want_acl = get_option('acl') want_acl = get_option('acl')
if want_acl != 'false' if want_acl != 'false'
libacl = cc.find_library('acl', required : want_acl == 'true') libacl = cc.find_library('acl', required : want_acl == 'true')
if libacl.found() have = libacl.found()
conf.set('HAVE_ACL', true)
m4_defines += ['-DHAVE_ACL']
endif
else else
have = false
libacl = [] libacl = []
endif endif
conf.set10('HAVE_ACL', have)
m4_defines += have ? ['-DHAVE_ACL'] : []
want_audit = get_option('audit') want_audit = get_option('audit')
if want_audit != 'false' if want_audit != 'false'
libaudit = dependency('audit', required : want_audit == 'true') libaudit = dependency('audit', required : want_audit == 'true')
conf.set('HAVE_AUDIT', libaudit.found()) have = libaudit.found()
else else
have = false
libaudit = [] libaudit = []
endif endif
conf.set10('HAVE_AUDIT', have)
want_blkid = get_option('blkid') want_blkid = get_option('blkid')
if want_blkid != 'false' if want_blkid != 'false'
libblkid = dependency('blkid', required : want_blkid == 'true') libblkid = dependency('blkid', required : want_blkid == 'true')
conf.set('HAVE_BLKID', libblkid.found()) have = libblkid.found()
else else
have = false
libblkid = [] libblkid = []
endif endif
conf.set10('HAVE_BLKID', have)
want_kmod = get_option('kmod') want_kmod = get_option('kmod')
if want_kmod != 'false' if want_kmod != 'false'
libkmod = dependency('libkmod', libkmod = dependency('libkmod',
version : '>= 15', version : '>= 15',
required : want_kmod == 'true') required : want_kmod == 'true')
conf.set('HAVE_KMOD', libkmod.found()) have = libkmod.found()
else else
have = false
libkmod = [] libkmod = []
endif endif
conf.set10('HAVE_KMOD', have)
want_pam = get_option('pam') want_pam = get_option('pam')
if want_pam != 'false' if want_pam != 'false'
libpam = cc.find_library('pam', required : want_pam == 'true') libpam = cc.find_library('pam', required : want_pam == 'true')
libpam_misc = cc.find_library('pam_misc', required : want_pam == 'true') libpam_misc = cc.find_library('pam_misc', required : want_pam == 'true')
if libpam.found() and libpam_misc.found() have = libpam.found() and libpam_misc.found()
conf.set('HAVE_PAM', true)
m4_defines += ['-DHAVE_PAM']
endif
else else
have = false
libpam = [] libpam = []
libpam_misc = [] libpam_misc = []
endif endif
conf.set10('HAVE_PAM', have)
m4_defines += have ? ['-DHAVE_PAM'] : []
want_microhttpd = get_option('microhttpd') want_microhttpd = get_option('microhttpd')
if want_microhttpd != 'false' if want_microhttpd != 'false'
libmicrohttpd = dependency('libmicrohttpd', libmicrohttpd = dependency('libmicrohttpd',
version : '>= 0.9.33', version : '>= 0.9.33',
required : want_microhttpd == 'true') required : want_microhttpd == 'true')
if libmicrohttpd.found() have = libmicrohttpd.found()
conf.set('HAVE_MICROHTTPD', true)
m4_defines += ['-DHAVE_MICROHTTPD']
endif
else else
have = false
libmicrohttpd = [] libmicrohttpd = []
endif endif
conf.set10('HAVE_MICROHTTPD', have)
m4_defines += have ? ['-DHAVE_MICROHTTPD'] : []
want_libcryptsetup = get_option('libcryptsetup') want_libcryptsetup = get_option('libcryptsetup')
if want_libcryptsetup != 'false' if want_libcryptsetup != 'false'
libcryptsetup = dependency('libcryptsetup', libcryptsetup = dependency('libcryptsetup',
version : '>= 1.6.0', version : '>= 1.6.0',
required : want_libcryptsetup == 'true') required : want_libcryptsetup == 'true')
conf.set('HAVE_LIBCRYPTSETUP', libcryptsetup.found()) have = libcryptsetup.found()
else else
have = false
libcryptsetup = [] libcryptsetup = []
endif endif
conf.set10('HAVE_LIBCRYPTSETUP', have)
want_libcurl = get_option('libcurl') want_libcurl = get_option('libcurl')
if want_libcurl != 'false' if want_libcurl != 'false'
libcurl = dependency('libcurl', libcurl = dependency('libcurl',
version : '>= 7.32.0', version : '>= 7.32.0',
required : want_libcurl == 'true') required : want_libcurl == 'true')
if libcurl.found() have = libcurl.found()
conf.set('HAVE_LIBCURL', true)
m4_defines += ['-DHAVE_LIBCURL']
endif
else else
have = false
libcurl = [] libcurl = []
endif endif
conf.set10('HAVE_LIBCURL', have)
m4_defines += have ? ['-DHAVE_LIBCURL'] : []
want_libidn = get_option('libidn') want_libidn = get_option('libidn')
want_libidn2 = get_option('libidn2') want_libidn2 = get_option('libidn2')
@ -821,125 +829,140 @@ endif
if want_libidn != 'false' and want_libidn2 != 'true' if want_libidn != 'false' and want_libidn2 != 'true'
libidn = dependency('libidn', libidn = dependency('libidn',
required : want_libidn == 'true') required : want_libidn == 'true')
if libidn.found() have = libidn.found()
conf.set('HAVE_LIBIDN', true)
m4_defines += ['-DHAVE_LIBIDN']
endif
else else
have = false
libidn = [] libidn = []
endif endif
if not conf.get('HAVE_LIBIDN', false) and want_libidn2 != 'false' conf.set10('HAVE_LIBIDN', have)
m4_defines += have ? ['-DHAVE_LIBIDN'] : []
if not have and want_libidn2 != 'false'
# libidn is used for both libidn and libidn2 objects # libidn is used for both libidn and libidn2 objects
libidn = dependency('libidn2', libidn = dependency('libidn2',
required : want_libidn2 == 'true') required : want_libidn2 == 'true')
if libidn.found() have = libidn.found()
conf.set('HAVE_LIBIDN2', true) else
m4_defines += ['-DHAVE_LIBIDN2'] have = false
endif
endif endif
conf.set10('HAVE_LIBIDN2', have)
m4_defines += have ? ['-DHAVE_LIBIDN2'] : []
want_libiptc = get_option('libiptc') want_libiptc = get_option('libiptc')
if want_libiptc != 'false' if want_libiptc != 'false'
libiptc = dependency('libiptc', libiptc = dependency('libiptc',
required : want_libiptc == 'true') required : want_libiptc == 'true')
if libiptc.found() have = libiptc.found()
conf.set('HAVE_LIBIPTC', true)
m4_defines += ['-DHAVE_LIBIPTC']
endif
else else
have = false
libiptc = [] libiptc = []
endif endif
conf.set10('HAVE_LIBIPTC', have)
m4_defines += have ? ['-DHAVE_LIBIPTC'] : []
want_qrencode = get_option('qrencode') want_qrencode = get_option('qrencode')
if want_qrencode != 'false' if want_qrencode != 'false'
libqrencode = dependency('libqrencode', libqrencode = dependency('libqrencode',
required : want_qrencode == 'true') required : want_qrencode == 'true')
conf.set('HAVE_QRENCODE', libqrencode.found()) have = libqrencode.found()
else else
have = false
libqrencode = [] libqrencode = []
endif endif
conf.set10('HAVE_QRENCODE', have)
want_gcrypt = get_option('gcrypt') want_gcrypt = get_option('gcrypt')
if want_gcrypt != 'false' if want_gcrypt != 'false'
libgcrypt = cc.find_library('gcrypt', required : want_gcrypt == 'true') libgcrypt = cc.find_library('gcrypt', required : want_gcrypt == 'true')
libgpg_error = cc.find_library('gpg-error', required : want_gcrypt == 'true') libgpg_error = cc.find_library('gpg-error', required : want_gcrypt == 'true')
have = libgcrypt.found() and libgpg_error.found()
have_deps = libgcrypt.found() and libgpg_error.found()
conf.set('HAVE_GCRYPT', have_deps)
if not have_deps
# link to neither of the libs if one is not found
libgcrypt = []
libgpg_error = []
endif
else else
have = false
endif
if not have
# link to neither of the libs if one is not found
libgcrypt = [] libgcrypt = []
libgpg_error = [] libgpg_error = []
endif endif
conf.set10('HAVE_GCRYPT', have)
want_gnutls = get_option('gnutls') want_gnutls = get_option('gnutls')
if want_gnutls != 'false' if want_gnutls != 'false'
libgnutls = dependency('gnutls', libgnutls = dependency('gnutls',
version : '>= 3.1.4', version : '>= 3.1.4',
required : want_gnutls == 'true') required : want_gnutls == 'true')
conf.set('HAVE_GNUTLS', libgnutls.found()) have = libgnutls.found()
else else
have = false
libgnutls = [] libgnutls = []
endif endif
conf.set10('HAVE_GNUTLS', have)
want_elfutils = get_option('elfutils') want_elfutils = get_option('elfutils')
if want_elfutils != 'false' if want_elfutils != 'false'
libdw = dependency('libdw', libdw = dependency('libdw',
required : want_elfutils == 'true') required : want_elfutils == 'true')
conf.set('HAVE_ELFUTILS', libdw.found()) have = libdw.found()
else else
have = false
libdw = [] libdw = []
endif endif
conf.set10('HAVE_ELFUTILS', have)
want_zlib = get_option('zlib') want_zlib = get_option('zlib')
if want_zlib != 'false' if want_zlib != 'false'
libz = dependency('zlib', libz = dependency('zlib',
required : want_zlib == 'true') required : want_zlib == 'true')
conf.set('HAVE_ZLIB', libz.found()) have = libz.found()
else else
have = false
libz = [] libz = []
endif endif
conf.set10('HAVE_ZLIB', have)
want_bzip2 = get_option('bzip2') want_bzip2 = get_option('bzip2')
if want_bzip2 != 'false' if want_bzip2 != 'false'
libbzip2 = cc.find_library('bz2', libbzip2 = cc.find_library('bz2',
required : want_bzip2 == 'true') required : want_bzip2 == 'true')
conf.set('HAVE_BZIP2', libbzip2.found()) have = libbzip2.found()
else else
have = false
libbzip2 = [] libbzip2 = []
endif endif
conf.set10('HAVE_BZIP2', have)
want_xz = get_option('xz') want_xz = get_option('xz')
if want_xz != 'false' if want_xz != 'false'
libxz = dependency('liblzma', libxz = dependency('liblzma',
required : want_xz == 'true') required : want_xz == 'true')
conf.set('HAVE_XZ', libxz.found()) have = libxz.found()
else else
have = false
libxz = [] libxz = []
endif endif
conf.set10('HAVE_XZ', have)
want_lz4 = get_option('lz4') want_lz4 = get_option('lz4')
if want_lz4 != 'false' if want_lz4 != 'false'
liblz4 = dependency('liblz4', liblz4 = dependency('liblz4',
required : want_lz4 == 'true') required : want_lz4 == 'true')
conf.set('HAVE_LZ4', liblz4.found()) have = liblz4.found()
else else
have = false
liblz4 = [] liblz4 = []
endif endif
conf.set10('HAVE_LZ4', have)
want_xkbcommon = get_option('xkbcommon') want_xkbcommon = get_option('xkbcommon')
if want_xkbcommon != 'false' if want_xkbcommon != 'false'
libxkbcommon = dependency('xkbcommon', libxkbcommon = dependency('xkbcommon',
version : '>= 0.3.0', version : '>= 0.3.0',
required : want_xkbcommon == 'true') required : want_xkbcommon == 'true')
conf.set('HAVE_XKBCOMMON', libxkbcommon.found()) have = libxkbcommon.found()
else else
have = false
libxkbcommon = [] libxkbcommon = []
endif endif
conf.set10('HAVE_XKBCOMMON', have)
want_glib = get_option('glib') want_glib = get_option('glib')
if want_glib != 'false' if want_glib != 'false'
@ -952,25 +975,28 @@ if want_glib != 'false'
libgio = dependency('gio-2.0', libgio = dependency('gio-2.0',
required : want_glib == 'true') required : want_glib == 'true')
have = libglib.found() and libgobject.found() and libgio.found() have = libglib.found() and libgobject.found() and libgio.found()
conf.set('HAVE_GLIB', have)
else else
have = false
libglib = [] libglib = []
libgobject = [] libgobject = []
libgio = [] libgio = []
endif endif
conf.set10('HAVE_GLIB', have)
want_dbus = get_option('dbus') want_dbus = get_option('dbus')
if want_dbus != 'false' if want_dbus != 'false'
libdbus = dependency('dbus-1', libdbus = dependency('dbus-1',
version : '>= 1.3.2', version : '>= 1.3.2',
required : want_dbus == 'true') required : want_dbus == 'true')
conf.set('HAVE_DBUS', libdbus.found()) have = libdbus.found()
else else
have = false
libdbus = [] libdbus = []
endif endif
conf.set10('HAVE_DBUS', have)
default_dnssec = get_option('default-dnssec') default_dnssec = get_option('default-dnssec')
if default_dnssec != 'no' and not conf.get('HAVE_GCRYPT', false) if default_dnssec != 'no' and conf.get('HAVE_GCRYPT') == 0
message('default-dnssec cannot be set to yes or allow-downgrade when gcrypt is disabled. Setting default-dnssec to no.') message('default-dnssec cannot be set to yes or allow-downgrade when gcrypt is disabled. Setting default-dnssec to no.')
default_dnssec = 'no' default_dnssec = 'no'
endif endif
@ -980,21 +1006,23 @@ substs.set('DEFAULT_DNSSEC_MODE', default_dnssec)
want_importd = get_option('importd') want_importd = get_option('importd')
if want_importd != 'false' if want_importd != 'false'
have_deps = (conf.get('HAVE_LIBCURL', false) and have = (conf.get('HAVE_LIBCURL') == 1 and
conf.get('HAVE_ZLIB', false) and conf.get('HAVE_ZLIB') == 1 and
conf.get('HAVE_BZIP2', false) and conf.get('HAVE_BZIP2') == 1 and
conf.get('HAVE_XZ', false) and conf.get('HAVE_XZ') == 1 and
conf.get('HAVE_GCRYPT', false)) conf.get('HAVE_GCRYPT') == 1)
conf.set('ENABLE_IMPORTD', have_deps) if want_importd == 'true' and not have
if want_importd == 'true' and not have_deps
error('importd support was requested, but dependencies are not available') error('importd support was requested, but dependencies are not available')
endif endif
else
have = false
endif endif
conf.set10('ENABLE_IMPORTD', have)
want_remote = get_option('remote') want_remote = get_option('remote')
if want_remote != 'false' if want_remote != 'false'
have_deps = [conf.get('HAVE_MICROHTTPD', false), have_deps = [conf.get('HAVE_MICROHTTPD') == 1,
conf.get('HAVE_LIBCURL', false)] conf.get('HAVE_LIBCURL') == 1]
# sd-j-remote requires µhttpd, and sd-j-upload requires libcurl, so # sd-j-remote requires µhttpd, and sd-j-upload requires libcurl, so
# it's possible to build one without the other. Complain only if # it's possible to build one without the other. Complain only if
# support was explictly requested. The auxiliary files like sysusers # support was explictly requested. The auxiliary files like sysusers
@ -1002,8 +1030,11 @@ if want_remote != 'false'
if want_remote == 'true' and not (have_deps[0] and have_deps[1]) if want_remote == 'true' and not (have_deps[0] and have_deps[1])
error('remote support was requested, but dependencies are not available') error('remote support was requested, but dependencies are not available')
endif endif
conf.set('ENABLE_REMOTE', have_deps[0] or have_deps[1]) have = have_deps[0] or have_deps[1]
else
have = false
endif endif
conf.set10('ENABLE_REMOTE', have)
foreach pair : [['utmp', 'HAVE_UTMP'], foreach pair : [['utmp', 'HAVE_UTMP'],
['hibernate', 'ENABLE_HIBERNATE'], ['hibernate', 'ENABLE_HIBERNATE'],
@ -1038,10 +1069,9 @@ foreach pair : [['utmp', 'HAVE_UTMP'],
['nss-systemd', 'ENABLE_NSS_SYSTEMD'], ['nss-systemd', 'ENABLE_NSS_SYSTEMD'],
] ]
if get_option(pair[0]) have = get_option(pair[0])
conf.set(pair[1], true) conf.set10(pair[1], have)
m4_defines += ['-D' + pair[1]] m4_defines += have ? ['-D' + pair[1]] : []
endif
endforeach endforeach
want_tests = get_option('tests') want_tests = get_option('tests')
@ -1072,11 +1102,14 @@ if get_option('efi')
gnu_efi_arch = '' gnu_efi_arch = ''
endif endif
conf.set('ENABLE_EFI', true) have = true
conf.set_quoted('EFI_MACHINE_TYPE_NAME', EFI_MACHINE_TYPE_NAME) conf.set_quoted('EFI_MACHINE_TYPE_NAME', EFI_MACHINE_TYPE_NAME)
conf.set('SD_TPM_PCR', get_option('tpm-pcrindex').to_int()) conf.set('SD_TPM_PCR', get_option('tpm-pcrindex').to_int())
else
have = false
endif endif
conf.set10('ENABLE_EFI', have)
##################################################################### #####################################################################
@ -1191,7 +1224,7 @@ foreach tuple : [['myhostname', 'HAVE_MYHOSTNAME'],
['mymachines', 'ENABLE_MACHINED'], ['mymachines', 'ENABLE_MACHINED'],
['resolve', 'ENABLE_RESOLVED']] ['resolve', 'ENABLE_RESOLVED']]
condition = tuple[1] == '' or conf.get(tuple[1], false) condition = tuple[1] == '' or conf.get(tuple[1]) == 1
if condition if condition
module = tuple[0] module = tuple[0]
@ -1319,7 +1352,7 @@ executable('systemd-fstab-generator',
install : true, install : true,
install_dir : systemgeneratordir) install_dir : systemgeneratordir)
if conf.get('ENABLE_ENVIRONMENT_D', false) if conf.get('ENABLE_ENVIRONMENT_D') == 1
executable('30-systemd-environment-d-generator', executable('30-systemd-environment-d-generator',
'src/environment-d-generator/environment-d-generator.c', 'src/environment-d-generator/environment-d-generator.c',
include_directories : includes, include_directories : includes,
@ -1333,7 +1366,7 @@ if conf.get('ENABLE_ENVIRONMENT_D', false)
join_paths(environmentdir, '99-environment.conf')) join_paths(environmentdir, '99-environment.conf'))
endif endif
if conf.get('ENABLE_HIBERNATE', false) if conf.get('ENABLE_HIBERNATE') == 1
executable('systemd-hibernate-resume-generator', executable('systemd-hibernate-resume-generator',
'src/hibernate-resume/hibernate-resume-generator.c', 'src/hibernate-resume/hibernate-resume-generator.c',
include_directories : includes, include_directories : includes,
@ -1351,7 +1384,7 @@ if conf.get('ENABLE_HIBERNATE', false)
install_dir : rootlibexecdir) install_dir : rootlibexecdir)
endif endif
if conf.get('HAVE_BLKID', false) if conf.get('HAVE_BLKID') == 1
executable('systemd-gpt-auto-generator', executable('systemd-gpt-auto-generator',
'src/gpt-auto-generator/gpt-auto-generator.c', 'src/gpt-auto-generator/gpt-auto-generator.c',
'src/basic/blkid-util.h', 'src/basic/blkid-util.h',
@ -1372,7 +1405,7 @@ if conf.get('HAVE_BLKID', false)
public_programs += [exe] public_programs += [exe]
endif endif
if conf.get('ENABLE_RESOLVED', false) if conf.get('ENABLE_RESOLVED') == 1
executable('systemd-resolved', executable('systemd-resolved',
systemd_resolved_sources, systemd_resolved_sources,
gcrypt_util_sources, gcrypt_util_sources,
@ -1402,7 +1435,7 @@ if conf.get('ENABLE_RESOLVED', false)
public_programs += [exe] public_programs += [exe]
endif endif
if conf.get('ENABLE_LOGIND', false) if conf.get('ENABLE_LOGIND') == 1
executable('systemd-logind', executable('systemd-logind',
systemd_logind_sources, systemd_logind_sources,
include_directories : includes, include_directories : includes,
@ -1435,7 +1468,7 @@ if conf.get('ENABLE_LOGIND', false)
install_dir : rootbindir) install_dir : rootbindir)
public_programs += [exe] public_programs += [exe]
if conf.get('HAVE_PAM', false) if conf.get('HAVE_PAM') == 1
version_script_arg = join_paths(meson.current_source_dir(), pam_systemd_sym) version_script_arg = join_paths(meson.current_source_dir(), pam_systemd_sym)
pam_systemd = shared_library( pam_systemd = shared_library(
'pam_systemd', 'pam_systemd',
@ -1459,7 +1492,7 @@ if conf.get('ENABLE_LOGIND', false)
endif endif
endif endif
if conf.get('HAVE_PAM', false) if conf.get('HAVE_PAM') == 1
executable('systemd-user-sessions', executable('systemd-user-sessions',
'src/user-sessions/user-sessions.c', 'src/user-sessions/user-sessions.c',
include_directories : includes, include_directories : includes,
@ -1469,7 +1502,7 @@ if conf.get('HAVE_PAM', false)
install_dir : rootlibexecdir) install_dir : rootlibexecdir)
endif endif
if conf.get('ENABLE_EFI', false) and conf.get('HAVE_BLKID', false) if conf.get('ENABLE_EFI') == 1 and conf.get('HAVE_BLKID') == 1
exe = executable('bootctl', exe = executable('bootctl',
'src/boot/bootctl.c', 'src/boot/bootctl.c',
include_directories : includes, include_directories : includes,
@ -1501,7 +1534,7 @@ exe = executable('systemctl', 'src/systemctl/systemctl.c',
install_dir : rootbindir) install_dir : rootbindir)
public_programs += [exe] public_programs += [exe]
if conf.get('ENABLE_BACKLIGHT', false) if conf.get('ENABLE_BACKLIGHT') == 1
executable('systemd-backlight', executable('systemd-backlight',
'src/backlight/backlight.c', 'src/backlight/backlight.c',
include_directories : includes, include_directories : includes,
@ -1511,7 +1544,7 @@ if conf.get('ENABLE_BACKLIGHT', false)
install_dir : rootlibexecdir) install_dir : rootlibexecdir)
endif endif
if conf.get('ENABLE_RFKILL', false) if conf.get('ENABLE_RFKILL') == 1
executable('systemd-rfkill', executable('systemd-rfkill',
'src/rfkill/rfkill.c', 'src/rfkill/rfkill.c',
include_directories : includes, include_directories : includes,
@ -1529,7 +1562,7 @@ executable('systemd-system-update-generator',
install : true, install : true,
install_dir : systemgeneratordir) install_dir : systemgeneratordir)
if conf.get('HAVE_LIBCRYPTSETUP', false) if conf.get('HAVE_LIBCRYPTSETUP') == 1
executable('systemd-cryptsetup', executable('systemd-cryptsetup',
'src/cryptsetup/cryptsetup.c', 'src/cryptsetup/cryptsetup.c',
include_directories : includes, include_directories : includes,
@ -1567,7 +1600,7 @@ if conf.get('HAVE_LIBCRYPTSETUP', false)
install_dir : systemgeneratordir) install_dir : systemgeneratordir)
endif endif
if conf.get('HAVE_SYSV_COMPAT', false) if conf.get('HAVE_SYSV_COMPAT') == 1
executable('systemd-sysv-generator', executable('systemd-sysv-generator',
'src/sysv-generator/sysv-generator.c', 'src/sysv-generator/sysv-generator.c',
include_directories : includes, include_directories : includes,
@ -1585,7 +1618,7 @@ if conf.get('HAVE_SYSV_COMPAT', false)
install_dir : systemgeneratordir) install_dir : systemgeneratordir)
endif endif
if conf.get('ENABLE_HOSTNAMED', false) if conf.get('ENABLE_HOSTNAMED') == 1
executable('systemd-hostnamed', executable('systemd-hostnamed',
'src/hostname/hostnamed.c', 'src/hostname/hostnamed.c',
include_directories : includes, include_directories : includes,
@ -1603,8 +1636,8 @@ if conf.get('ENABLE_HOSTNAMED', false)
public_programs += [exe] public_programs += [exe]
endif endif
if conf.get('ENABLE_LOCALED', false) if conf.get('ENABLE_LOCALED') == 1
if conf.get('HAVE_XKBCOMMON', false) if conf.get('HAVE_XKBCOMMON') == 1
# logind will load libxkbcommon.so dynamically on its own # logind will load libxkbcommon.so dynamically on its own
deps = [libdl] deps = [libdl]
else else
@ -1629,7 +1662,7 @@ if conf.get('ENABLE_LOCALED', false)
public_programs += [exe] public_programs += [exe]
endif endif
if conf.get('ENABLE_TIMEDATED', false) if conf.get('ENABLE_TIMEDATED') == 1
executable('systemd-timedated', executable('systemd-timedated',
'src/timedate/timedated.c', 'src/timedate/timedated.c',
include_directories : includes, include_directories : includes,
@ -1647,7 +1680,7 @@ if conf.get('ENABLE_TIMEDATED', false)
public_programs += [exe] public_programs += [exe]
endif endif
if conf.get('ENABLE_TIMESYNCD', false) if conf.get('ENABLE_TIMESYNCD') == 1
executable('systemd-timesyncd', executable('systemd-timesyncd',
systemd_timesyncd_sources, systemd_timesyncd_sources,
include_directories : includes, include_directories : includes,
@ -1659,7 +1692,7 @@ if conf.get('ENABLE_TIMESYNCD', false)
install_dir : rootlibexecdir) install_dir : rootlibexecdir)
endif endif
if conf.get('ENABLE_MACHINED', false) if conf.get('ENABLE_MACHINED') == 1
executable('systemd-machined', executable('systemd-machined',
systemd_machined_sources, systemd_machined_sources,
include_directories : includes, include_directories : includes,
@ -1682,7 +1715,7 @@ if conf.get('ENABLE_MACHINED', false)
public_programs += [exe] public_programs += [exe]
endif endif
if conf.get('ENABLE_IMPORTD', false) if conf.get('ENABLE_IMPORTD') == 1
executable('systemd-importd', executable('systemd-importd',
systemd_importd_sources, systemd_importd_sources,
include_directories : includes, include_directories : includes,
@ -1731,7 +1764,7 @@ if conf.get('ENABLE_IMPORTD', false)
public_programs += [systemd_pull, systemd_import, systemd_export] public_programs += [systemd_pull, systemd_import, systemd_export]
endif endif
if conf.get('ENABLE_REMOTE', false) and conf.get('HAVE_LIBCURL', false) if conf.get('ENABLE_REMOTE') == 1 and conf.get('HAVE_LIBCURL') == 1
exe = executable('systemd-journal-upload', exe = executable('systemd-journal-upload',
systemd_journal_upload_sources, systemd_journal_upload_sources,
include_directories : includes, include_directories : includes,
@ -1747,7 +1780,7 @@ if conf.get('ENABLE_REMOTE', false) and conf.get('HAVE_LIBCURL', false)
public_programs += [exe] public_programs += [exe]
endif endif
if conf.get('ENABLE_REMOTE', false) and conf.get('HAVE_MICROHTTPD', false) if conf.get('ENABLE_REMOTE') == 1 and conf.get('HAVE_MICROHTTPD') == 1
s_j_remote = executable('systemd-journal-remote', s_j_remote = executable('systemd-journal-remote',
systemd_journal_remote_sources, systemd_journal_remote_sources,
include_directories : includes, include_directories : includes,
@ -1776,7 +1809,7 @@ if conf.get('ENABLE_REMOTE', false) and conf.get('HAVE_MICROHTTPD', false)
public_programs += [s_j_remote, s_j_gatewayd] public_programs += [s_j_remote, s_j_gatewayd]
endif endif
if conf.get('ENABLE_COREDUMP', false) if conf.get('ENABLE_COREDUMP') == 1
executable('systemd-coredump', executable('systemd-coredump',
systemd_coredump_sources, systemd_coredump_sources,
include_directories : includes, include_directories : includes,
@ -1802,7 +1835,7 @@ if conf.get('ENABLE_COREDUMP', false)
public_programs += [exe] public_programs += [exe]
endif endif
if conf.get('ENABLE_BINFMT', false) if conf.get('ENABLE_BINFMT') == 1
exe = executable('systemd-binfmt', exe = executable('systemd-binfmt',
'src/binfmt/binfmt.c', 'src/binfmt/binfmt.c',
include_directories : includes, include_directories : includes,
@ -1818,7 +1851,7 @@ if conf.get('ENABLE_BINFMT', false)
mkdir_p.format(join_paths(sysconfdir, 'binfmt.d'))) mkdir_p.format(join_paths(sysconfdir, 'binfmt.d')))
endif endif
if conf.get('ENABLE_VCONSOLE', false) if conf.get('ENABLE_VCONSOLE') == 1
executable('systemd-vconsole-setup', executable('systemd-vconsole-setup',
'src/vconsole/vconsole-setup.c', 'src/vconsole/vconsole-setup.c',
include_directories : includes, include_directories : includes,
@ -1828,7 +1861,7 @@ if conf.get('ENABLE_VCONSOLE', false)
install_dir : rootlibexecdir) install_dir : rootlibexecdir)
endif endif
if conf.get('ENABLE_RANDOMSEED', false) if conf.get('ENABLE_RANDOMSEED') == 1
executable('systemd-random-seed', executable('systemd-random-seed',
'src/random-seed/random-seed.c', 'src/random-seed/random-seed.c',
include_directories : includes, include_directories : includes,
@ -1838,7 +1871,7 @@ if conf.get('ENABLE_RANDOMSEED', false)
install_dir : rootlibexecdir) install_dir : rootlibexecdir)
endif endif
if conf.get('ENABLE_FIRSTBOOT', false) if conf.get('ENABLE_FIRSTBOOT') == 1
executable('systemd-firstboot', executable('systemd-firstboot',
'src/firstboot/firstboot.c', 'src/firstboot/firstboot.c',
include_directories : includes, include_directories : includes,
@ -2047,7 +2080,7 @@ exe = executable('busctl',
install : true) install : true)
public_programs += [exe] public_programs += [exe]
if conf.get('ENABLE_SYSUSERS', false) if conf.get('ENABLE_SYSUSERS') == 1
exe = executable('systemd-sysusers', exe = executable('systemd-sysusers',
'src/sysusers/sysusers.c', 'src/sysusers/sysusers.c',
include_directories : includes, include_directories : includes,
@ -2058,7 +2091,7 @@ if conf.get('ENABLE_SYSUSERS', false)
public_programs += [exe] public_programs += [exe]
endif endif
if conf.get('ENABLE_TMPFILES', false) if conf.get('ENABLE_TMPFILES') == 1
exe = executable('systemd-tmpfiles', exe = executable('systemd-tmpfiles',
'src/tmpfiles/tmpfiles.c', 'src/tmpfiles/tmpfiles.c',
include_directories : includes, include_directories : includes,
@ -2070,7 +2103,7 @@ if conf.get('ENABLE_TMPFILES', false)
public_programs += [exe] public_programs += [exe]
endif endif
if conf.get('ENABLE_HWDB', false) if conf.get('ENABLE_HWDB') == 1
exe = executable('systemd-hwdb', exe = executable('systemd-hwdb',
'src/hwdb/hwdb.c', 'src/hwdb/hwdb.c',
'src/libsystemd/sd-hwdb/hwdb-internal.h', 'src/libsystemd/sd-hwdb/hwdb-internal.h',
@ -2082,7 +2115,7 @@ if conf.get('ENABLE_HWDB', false)
public_programs += [exe] public_programs += [exe]
endif endif
if conf.get('ENABLE_QUOTACHECK', false) if conf.get('ENABLE_QUOTACHECK') == 1
executable('systemd-quotacheck', executable('systemd-quotacheck',
'src/quotacheck/quotacheck.c', 'src/quotacheck/quotacheck.c',
include_directories : includes, include_directories : includes,
@ -2160,7 +2193,7 @@ executable('systemd-update-utmp',
install : true, install : true,
install_dir : rootlibexecdir) install_dir : rootlibexecdir)
if conf.get('HAVE_KMOD', false) if conf.get('HAVE_KMOD') == 1
executable('systemd-modules-load', executable('systemd-modules-load',
'src/modules-load/modules-load.c', 'src/modules-load/modules-load.c',
include_directories : includes, include_directories : includes,
@ -2192,7 +2225,7 @@ exe = executable('systemd-nspawn',
install : true) install : true)
public_programs += [exe] public_programs += [exe]
if conf.get('ENABLE_NETWORKD', false) if conf.get('ENABLE_NETWORKD') == 1
executable('systemd-networkd', executable('systemd-networkd',
systemd_networkd_sources, systemd_networkd_sources,
include_directories : includes, include_directories : includes,
@ -2242,7 +2275,7 @@ foreach tuple : tests
type = '' type = ''
endif endif
if condition == '' or conf.get(condition, false) if condition == '' or conf.get(condition) == 1
exe = executable( exe = executable(
name, name,
sources, sources,
@ -2448,7 +2481,7 @@ status += [
# CPPFLAGS: ${OUR_CPPFLAGS} ${CPPFLAGS} # CPPFLAGS: ${OUR_CPPFLAGS} ${CPPFLAGS}
# LDFLAGS: ${OUR_LDFLAGS} ${LDFLAGS} # LDFLAGS: ${OUR_LDFLAGS} ${LDFLAGS}
if conf.get('ENABLE_EFI', false) if conf.get('ENABLE_EFI') == 1
status += [ status += [
'efi arch: @0@'.format(efi_arch)] 'efi arch: @0@'.format(efi_arch)]
@ -2519,13 +2552,13 @@ foreach tuple : [
['blkid'], ['blkid'],
['dbus'], ['dbus'],
['glib'], ['glib'],
['nss-myhostname', conf.get('HAVE_MYHOSTNAME', false)], ['nss-myhostname', conf.get('HAVE_MYHOSTNAME') == 1],
['hwdb'], ['hwdb'],
['tpm'], ['tpm'],
['man pages', want_man], ['man pages', want_man],
['html pages', want_html], ['html pages', want_html],
['man page indices', want_man and have_lxml], ['man page indices', want_man and have_lxml],
['split /usr', conf.get('HAVE_SPLIT_USR', false)], ['split /usr', conf.get('HAVE_SPLIT_USR') == 1],
['SysV compat'], ['SysV compat'],
['utmp'], ['utmp'],
['ldconfig'], ['ldconfig'],
@ -2541,7 +2574,7 @@ foreach tuple : [
if cond == '' if cond == ''
ident1 = 'HAVE_' + tuple[0].underscorify().to_upper() ident1 = 'HAVE_' + tuple[0].underscorify().to_upper()
ident2 = 'ENABLE_' + tuple[0].underscorify().to_upper() ident2 = 'ENABLE_' + tuple[0].underscorify().to_upper()
cond = conf.get(ident1, false) or conf.get(ident2, false) cond = conf.get(ident1, 0) == 1 or conf.get(ident2, 0) == 1
endif endif
if cond if cond
found += [tuple[0]] found += [tuple[0]]

View File

@ -1,4 +1,4 @@
if conf.get('ENABLE_NETWORKD', false) if conf.get('ENABLE_NETWORKD') == 1
install_data('80-container-host0.network', install_data('80-container-host0.network',
'80-container-ve.network', '80-container-ve.network',
'80-container-vz.network', '80-container-vz.network',

View File

@ -42,7 +42,7 @@ if bashcompletiondir != 'no'
] ]
foreach item : items foreach item : items
if item[1] == '' or conf.get(item[1], false) if item[1] == '' or conf.get(item[1]) == 1
install_data(item[0], install_data(item[0],
install_dir : bashcompletiondir) install_dir : bashcompletiondir)
endif endif

View File

@ -39,7 +39,7 @@ if zshcompletiondir != 'no'
] ]
foreach item : items foreach item : items
if item[1] == '' or conf.get(item[1], false) if item[1] == '' or conf.get(item[1]) == 1
install_data(item[0], install_data(item[0],
install_dir : zshcompletiondir) install_dir : zshcompletiondir)
endif endif

View File

@ -36,7 +36,7 @@
#include "log.h" #include "log.h"
#include "pager.h" #include "pager.h"
#include "parse-util.h" #include "parse-util.h"
#ifdef HAVE_SECCOMP #if HAVE_SECCOMP
#include "seccomp-util.h" #include "seccomp-util.h"
#endif #endif
#include "special.h" #include "special.h"
@ -1337,7 +1337,7 @@ static int get_log_target(sd_bus *bus, char **args) {
return 0; return 0;
} }
#ifdef HAVE_SECCOMP #if HAVE_SECCOMP
static void dump_syscall_filter(const SyscallFilterSet *set) { static void dump_syscall_filter(const SyscallFilterSet *set) {
const char *syscall; const char *syscall;

View File

@ -19,13 +19,13 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>. along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/ ***/
#ifdef HAVE_BLKID #if HAVE_BLKID
#include <blkid.h> #include <blkid.h>
#endif #endif
#include "util.h" #include "util.h"
#ifdef HAVE_BLKID #if HAVE_BLKID
DEFINE_TRIVIAL_CLEANUP_FUNC(blkid_probe, blkid_free_probe); DEFINE_TRIVIAL_CLEANUP_FUNC(blkid_probe, blkid_free_probe);
#define _cleanup_blkid_free_probe_ _cleanup_(blkid_free_probep) #define _cleanup_blkid_free_probe_ _cleanup_(blkid_free_probep)
#endif #endif

View File

@ -32,7 +32,7 @@
#include <sys/sysmacros.h> #include <sys/sysmacros.h>
#include <unistd.h> #include <unistd.h>
#ifdef HAVE_LINUX_BTRFS_H #if HAVE_LINUX_BTRFS_H
#include <linux/btrfs.h> #include <linux/btrfs.h>
#endif #endif

View File

@ -19,121 +19,121 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>. along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/ ***/
#ifdef HAVE_PAM #if HAVE_PAM
#define _PAM_FEATURE_ "+PAM" #define _PAM_FEATURE_ "+PAM"
#else #else
#define _PAM_FEATURE_ "-PAM" #define _PAM_FEATURE_ "-PAM"
#endif #endif
#ifdef HAVE_AUDIT #if HAVE_AUDIT
#define _AUDIT_FEATURE_ "+AUDIT" #define _AUDIT_FEATURE_ "+AUDIT"
#else #else
#define _AUDIT_FEATURE_ "-AUDIT" #define _AUDIT_FEATURE_ "-AUDIT"
#endif #endif
#ifdef HAVE_SELINUX #if HAVE_SELINUX
#define _SELINUX_FEATURE_ "+SELINUX" #define _SELINUX_FEATURE_ "+SELINUX"
#else #else
#define _SELINUX_FEATURE_ "-SELINUX" #define _SELINUX_FEATURE_ "-SELINUX"
#endif #endif
#ifdef HAVE_APPARMOR #if HAVE_APPARMOR
#define _APPARMOR_FEATURE_ "+APPARMOR" #define _APPARMOR_FEATURE_ "+APPARMOR"
#else #else
#define _APPARMOR_FEATURE_ "-APPARMOR" #define _APPARMOR_FEATURE_ "-APPARMOR"
#endif #endif
#ifdef HAVE_IMA #if HAVE_IMA
#define _IMA_FEATURE_ "+IMA" #define _IMA_FEATURE_ "+IMA"
#else #else
#define _IMA_FEATURE_ "-IMA" #define _IMA_FEATURE_ "-IMA"
#endif #endif
#ifdef HAVE_SMACK #if HAVE_SMACK
#define _SMACK_FEATURE_ "+SMACK" #define _SMACK_FEATURE_ "+SMACK"
#else #else
#define _SMACK_FEATURE_ "-SMACK" #define _SMACK_FEATURE_ "-SMACK"
#endif #endif
#ifdef HAVE_SYSV_COMPAT #if HAVE_SYSV_COMPAT
#define _SYSVINIT_FEATURE_ "+SYSVINIT" #define _SYSVINIT_FEATURE_ "+SYSVINIT"
#else #else
#define _SYSVINIT_FEATURE_ "-SYSVINIT" #define _SYSVINIT_FEATURE_ "-SYSVINIT"
#endif #endif
#ifdef HAVE_UTMP #if HAVE_UTMP
#define _UTMP_FEATURE_ "+UTMP" #define _UTMP_FEATURE_ "+UTMP"
#else #else
#define _UTMP_FEATURE_ "-UTMP" #define _UTMP_FEATURE_ "-UTMP"
#endif #endif
#ifdef HAVE_LIBCRYPTSETUP #if HAVE_LIBCRYPTSETUP
#define _LIBCRYPTSETUP_FEATURE_ "+LIBCRYPTSETUP" #define _LIBCRYPTSETUP_FEATURE_ "+LIBCRYPTSETUP"
#else #else
#define _LIBCRYPTSETUP_FEATURE_ "-LIBCRYPTSETUP" #define _LIBCRYPTSETUP_FEATURE_ "-LIBCRYPTSETUP"
#endif #endif
#ifdef HAVE_GCRYPT #if HAVE_GCRYPT
#define _GCRYPT_FEATURE_ "+GCRYPT" #define _GCRYPT_FEATURE_ "+GCRYPT"
#else #else
#define _GCRYPT_FEATURE_ "-GCRYPT" #define _GCRYPT_FEATURE_ "-GCRYPT"
#endif #endif
#ifdef HAVE_GNUTLS #if HAVE_GNUTLS
#define _GNUTLS_FEATURE_ "+GNUTLS" #define _GNUTLS_FEATURE_ "+GNUTLS"
#else #else
#define _GNUTLS_FEATURE_ "-GNUTLS" #define _GNUTLS_FEATURE_ "-GNUTLS"
#endif #endif
#ifdef HAVE_ACL #if HAVE_ACL
#define _ACL_FEATURE_ "+ACL" #define _ACL_FEATURE_ "+ACL"
#else #else
#define _ACL_FEATURE_ "-ACL" #define _ACL_FEATURE_ "-ACL"
#endif #endif
#ifdef HAVE_XZ #if HAVE_XZ
#define _XZ_FEATURE_ "+XZ" #define _XZ_FEATURE_ "+XZ"
#else #else
#define _XZ_FEATURE_ "-XZ" #define _XZ_FEATURE_ "-XZ"
#endif #endif
#ifdef HAVE_LZ4 #if HAVE_LZ4
#define _LZ4_FEATURE_ "+LZ4" #define _LZ4_FEATURE_ "+LZ4"
#else #else
#define _LZ4_FEATURE_ "-LZ4" #define _LZ4_FEATURE_ "-LZ4"
#endif #endif
#ifdef HAVE_SECCOMP #if HAVE_SECCOMP
#define _SECCOMP_FEATURE_ "+SECCOMP" #define _SECCOMP_FEATURE_ "+SECCOMP"
#else #else
#define _SECCOMP_FEATURE_ "-SECCOMP" #define _SECCOMP_FEATURE_ "-SECCOMP"
#endif #endif
#ifdef HAVE_BLKID #if HAVE_BLKID
#define _BLKID_FEATURE_ "+BLKID" #define _BLKID_FEATURE_ "+BLKID"
#else #else
#define _BLKID_FEATURE_ "-BLKID" #define _BLKID_FEATURE_ "-BLKID"
#endif #endif
#ifdef HAVE_ELFUTILS #if HAVE_ELFUTILS
#define _ELFUTILS_FEATURE_ "+ELFUTILS" #define _ELFUTILS_FEATURE_ "+ELFUTILS"
#else #else
#define _ELFUTILS_FEATURE_ "-ELFUTILS" #define _ELFUTILS_FEATURE_ "-ELFUTILS"
#endif #endif
#ifdef HAVE_KMOD #if HAVE_KMOD
#define _KMOD_FEATURE_ "+KMOD" #define _KMOD_FEATURE_ "+KMOD"
#else #else
#define _KMOD_FEATURE_ "-KMOD" #define _KMOD_FEATURE_ "-KMOD"
#endif #endif
#ifdef HAVE_LIBIDN2 #if HAVE_LIBIDN2
#define _IDN2_FEATURE_ "+IDN2" #define _IDN2_FEATURE_ "+IDN2"
#else #else
#define _IDN2_FEATURE_ "-IDN2" #define _IDN2_FEATURE_ "-IDN2"
#endif #endif
#ifdef HAVE_LIBIDN #if HAVE_LIBIDN
#define _IDN_FEATURE_ "+IDN" #define _IDN_FEATURE_ "+IDN"
#else #else
#define _IDN_FEATURE_ "-IDN" #define _IDN_FEATURE_ "-IDN"

View File

@ -43,7 +43,7 @@
#define SIGNALS_CRASH_HANDLER SIGSEGV,SIGILL,SIGFPE,SIGBUS,SIGQUIT,SIGABRT #define SIGNALS_CRASH_HANDLER SIGSEGV,SIGILL,SIGFPE,SIGBUS,SIGQUIT,SIGABRT
#define SIGNALS_IGNORE SIGPIPE #define SIGNALS_IGNORE SIGPIPE
#ifdef HAVE_SPLIT_USR #if HAVE_SPLIT_USR
#define KBD_KEYMAP_DIRS \ #define KBD_KEYMAP_DIRS \
"/usr/share/keymaps/\0" \ "/usr/share/keymaps/\0" \
"/usr/share/kbd/keymaps/\0" \ "/usr/share/kbd/keymaps/\0" \
@ -68,7 +68,7 @@
#define NOTIFY_FD_MAX 768 #define NOTIFY_FD_MAX 768
#define NOTIFY_BUFFER_MAX PIPE_BUF #define NOTIFY_BUFFER_MAX PIPE_BUF
#ifdef HAVE_SPLIT_USR #if HAVE_SPLIT_USR
# define _CONF_PATHS_SPLIT_USR(n) "/lib/" n "\0" # define _CONF_PATHS_SPLIT_USR(n) "/lib/" n "\0"
#else #else
# define _CONF_PATHS_SPLIT_USR(n) # define _CONF_PATHS_SPLIT_USR(n)

View File

@ -34,7 +34,7 @@
#include "strv.h" #include "strv.h"
#include "util.h" #include "util.h"
#ifdef ENABLE_DEBUG_HASHMAP #if ENABLE_DEBUG_HASHMAP
#include <pthread.h> #include <pthread.h>
#include "list.h" #include "list.h"
#endif #endif
@ -142,7 +142,7 @@ typedef uint8_t dib_raw_t;
#define DIB_FREE UINT_MAX #define DIB_FREE UINT_MAX
#ifdef ENABLE_DEBUG_HASHMAP #if ENABLE_DEBUG_HASHMAP
struct hashmap_debug_info { struct hashmap_debug_info {
LIST_FIELDS(struct hashmap_debug_info, debug_list); LIST_FIELDS(struct hashmap_debug_info, debug_list);
unsigned max_entries; /* high watermark of n_entries */ 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); dibs = dib_raw_ptr(h);
assert(dibs[idx] != DIB_RAW_FREE); assert(dibs[idx] != DIB_RAW_FREE);
#ifdef ENABLE_DEBUG_HASHMAP #if ENABLE_DEBUG_HASHMAP
h->debug.rem_count++; h->debug.rem_count++;
h->debug.last_rem_idx = idx; h->debug.last_rem_idx = idx;
#endif #endif
@ -578,7 +578,7 @@ static unsigned hashmap_iterate_in_insertion_order(OrderedHashmap *h, Iterator *
assert(e->p.b.key == i->next_key); assert(e->p.b.key == i->next_key);
} }
#ifdef ENABLE_DEBUG_HASHMAP #if ENABLE_DEBUG_HASHMAP
i->prev_idx = idx; i->prev_idx = idx;
#endif #endif
@ -635,7 +635,7 @@ static unsigned hashmap_iterate_in_internal_order(HashmapBase *h, Iterator *i) {
} }
idx = i->idx; idx = i->idx;
#ifdef ENABLE_DEBUG_HASHMAP #if ENABLE_DEBUG_HASHMAP
i->prev_idx = idx; i->prev_idx = idx;
#endif #endif
@ -658,7 +658,7 @@ static unsigned hashmap_iterate_entry(HashmapBase *h, Iterator *i) {
return IDX_NIL; return IDX_NIL;
} }
#ifdef ENABLE_DEBUG_HASHMAP #if ENABLE_DEBUG_HASHMAP
if (i->idx == IDX_FIRST) { if (i->idx == IDX_FIRST) {
i->put_count = h->debug.put_count; i->put_count = h->debug.put_count;
i->rem_count = h->debug.rem_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; shared_hash_key_initialized= true;
} }
#ifdef ENABLE_DEBUG_HASHMAP #if ENABLE_DEBUG_HASHMAP
h->debug.func = func; h->debug.func = func;
h->debug.file = file; h->debug.file = file;
h->debug.line = line; h->debug.line = line;
@ -807,7 +807,7 @@ static void hashmap_free_no_clear(HashmapBase *h) {
assert(!h->has_indirect); assert(!h->has_indirect);
assert(!h->n_direct_entries); assert(!h->n_direct_entries);
#ifdef ENABLE_DEBUG_HASHMAP #if ENABLE_DEBUG_HASHMAP
assert_se(pthread_mutex_lock(&hashmap_debug_list_mutex) == 0); assert_se(pthread_mutex_lock(&hashmap_debug_list_mutex) == 0);
LIST_REMOVE(debug_list, hashmap_debug_list, &h->debug); LIST_REMOVE(debug_list, hashmap_debug_list, &h->debug);
assert_se(pthread_mutex_unlock(&hashmap_debug_list_mutex) == 0); 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; dib_raw_t raw_dib, *dibs;
unsigned dib, distance; unsigned dib, distance;
#ifdef ENABLE_DEBUG_HASHMAP #if ENABLE_DEBUG_HASHMAP
h->debug.put_count++; h->debug.put_count++;
#endif #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); assert_se(hashmap_put_robin_hood(h, idx, swap) == false);
n_entries_inc(h); n_entries_inc(h);
#ifdef ENABLE_DEBUG_HASHMAP #if ENABLE_DEBUG_HASHMAP
h->debug.max_entries = MAX(h->debug.max_entries, n_entries(h)); h->debug.max_entries = MAX(h->debug.max_entries, n_entries(h));
#endif #endif
@ -1240,7 +1240,7 @@ int hashmap_replace(Hashmap *h, const void *key, void *value) {
idx = bucket_scan(h, hash, key); idx = bucket_scan(h, hash, key);
if (idx != IDX_NIL) { if (idx != IDX_NIL) {
e = plain_bucket_at(h, idx); 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, /* Although the key is equal, the key pointer may have changed,
* and this would break our assumption for iterating. So count * and this would break our assumption for iterating. So count
* this operation as incompatible with iteration. */ * this operation as incompatible with iteration. */

View File

@ -58,7 +58,7 @@ typedef struct Set Set; /* Stores just keys */
typedef struct { typedef struct {
unsigned idx; /* index of an entry to be iterated next */ unsigned idx; /* index of an entry to be iterated next */
const void *next_key; /* expected value of that entry's key pointer */ 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 put_count; /* hashmap's put_count recorded at start of iteration */
unsigned rem_count; /* hashmap's rem_count in previous iteration */ unsigned rem_count; /* hashmap's rem_count in previous iteration */
unsigned prev_idx; /* idx in previous iteration */ unsigned prev_idx; /* idx in previous iteration */
@ -89,7 +89,7 @@ typedef struct {
(Hashmap*)(h), \ (Hashmap*)(h), \
(void)0) (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_PARAMS , const char *func, const char *file, int line
# define HASHMAP_DEBUG_SRC_ARGS , __func__, __FILE__, __LINE__ # define HASHMAP_DEBUG_SRC_ARGS , __func__, __FILE__, __LINE__
# define HASHMAP_DEBUG_PASS_ARGS , func, file, line # define HASHMAP_DEBUG_PASS_ARGS , func, file, line

View File

@ -21,7 +21,7 @@
#include <fcntl.h> #include <fcntl.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <unistd.h> #include <unistd.h>
#ifdef HAVE_LINUX_MEMFD_H #if HAVE_LINUX_MEMFD_H
#include <linux/memfd.h> #include <linux/memfd.h>
#endif #endif
#include <stdio.h> #include <stdio.h>

View File

@ -40,7 +40,7 @@
#include <uchar.h> #include <uchar.h>
#include <unistd.h> #include <unistd.h>
#ifdef HAVE_AUDIT #if HAVE_AUDIT
#include <libaudit.h> #include <libaudit.h>
#endif #endif
@ -48,11 +48,11 @@
#include <asm/sgidefs.h> #include <asm/sgidefs.h>
#endif #endif
#ifdef HAVE_LINUX_BTRFS_H #if HAVE_LINUX_BTRFS_H
#include <linux/btrfs.h> #include <linux/btrfs.h>
#endif #endif
#ifdef HAVE_LINUX_VM_SOCKETS_H #if HAVE_LINUX_VM_SOCKETS_H
#include <linux/vm_sockets.h> #include <linux/vm_sockets.h>
#else #else
#define VMADDR_CID_ANY -1U #define VMADDR_CID_ANY -1U
@ -204,7 +204,7 @@ struct sockaddr_vm {
#define BTRFS_QGROUP_LEVEL_SHIFT 48 #define BTRFS_QGROUP_LEVEL_SHIFT 48
#endif #endif
#ifndef HAVE_LINUX_BTRFS_H #if ! HAVE_LINUX_BTRFS_H
struct btrfs_ioctl_vol_args { struct btrfs_ioctl_vol_args {
int64_t fd; int64_t fd;
char name[BTRFS_PATH_NAME_MAX + 1]; char name[BTRFS_PATH_NAME_MAX + 1];
@ -546,8 +546,8 @@ struct btrfs_ioctl_quota_ctl_args {
#define MAX_HANDLE_SZ 128 #define MAX_HANDLE_SZ 128
#endif #endif
#ifndef HAVE_SECURE_GETENV #if ! HAVE_SECURE_GETENV
# ifdef HAVE___SECURE_GETENV # if HAVE___SECURE_GETENV
# define secure_getenv __secure_getenv # define secure_getenv __secure_getenv
# else # else
# error "neither secure_getenv nor __secure_getenv are available" # error "neither secure_getenv nor __secure_getenv are available"
@ -1108,7 +1108,7 @@ struct input_mask {
#define KEY_ALS_TOGGLE 0x230 #define KEY_ALS_TOGGLE 0x230
#endif #endif
#ifndef HAVE_KEY_SERIAL_T #if ! HAVE_KEY_SERIAL_T
typedef int32_t key_serial_t; typedef int32_t key_serial_t;
#endif #endif
@ -1204,11 +1204,11 @@ typedef int32_t key_serial_t;
#ifndef IF_OPER_UP #ifndef IF_OPER_UP
#define IF_OPER_UP 6 #define IF_OPER_UP 6
#ifndef HAVE_CHAR32_T #if ! HAVE_CHAR32_T
#define char32_t uint32_t #define char32_t uint32_t
#endif #endif
#ifndef HAVE_CHAR16_T #if ! HAVE_CHAR16_T
#define char16_t uint16_t #define char16_t uint16_t
#endif #endif
@ -1220,7 +1220,7 @@ typedef int32_t key_serial_t;
#define IFA_F_MCAUTOJOIN 0x400 #define IFA_F_MCAUTOJOIN 0x400
#endif #endif
#ifndef HAVE_STRUCT_ETHTOOL_LINK_SETTINGS #if ! HAVE_STRUCT_ETHTOOL_LINK_SETTINGS
#define ETHTOOL_GLINKSETTINGS 0x0000004c /* Get ethtool_link_settings */ #define ETHTOOL_GLINKSETTINGS 0x0000004c /* Get ethtool_link_settings */
#define ETHTOOL_SLINKSETTINGS 0x0000004d /* Set ethtool_link_settings */ #define ETHTOOL_SLINKSETTINGS 0x0000004d /* Set ethtool_link_settings */
@ -1247,7 +1247,7 @@ struct ethtool_link_settings {
#endif #endif
#ifndef HAVE_STRUCT_FIB_RULE_UID_RANGE #if ! HAVE_STRUCT_FIB_RULE_UID_RANGE
struct fib_rule_uid_range { struct fib_rule_uid_range {
__u32 start; __u32 start;

View File

@ -30,7 +30,7 @@
#define DEFAULT_PATH_NORMAL "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin" #define DEFAULT_PATH_NORMAL "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin"
#define DEFAULT_PATH_SPLIT_USR DEFAULT_PATH_NORMAL ":/sbin:/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 # define DEFAULT_PATH DEFAULT_PATH_SPLIT_USR
#else #else
# define DEFAULT_PATH DEFAULT_PATH_NORMAL # define DEFAULT_PATH DEFAULT_PATH_NORMAL

View File

@ -34,7 +34,7 @@
#include <sys/wait.h> #include <sys/wait.h>
#include <syslog.h> #include <syslog.h>
#include <unistd.h> #include <unistd.h>
#ifdef HAVE_VALGRIND_VALGRIND_H #if HAVE_VALGRIND_VALGRIND_H
#include <valgrind/valgrind.h> #include <valgrind/valgrind.h>
#endif #endif
@ -945,7 +945,7 @@ int opinionated_personality(unsigned long *ret) {
} }
void valgrind_summary_hack(void) { void valgrind_summary_hack(void) {
#ifdef HAVE_VALGRIND_VALGRIND_H #if HAVE_VALGRIND_VALGRIND_H
if (getpid_cached() == 1 && RUNNING_ON_VALGRIND) { if (getpid_cached() == 1 && RUNNING_ON_VALGRIND) {
pid_t pid; pid_t pid;
pid = raw_clone(SIGCHLD); pid = raw_clone(SIGCHLD);

View File

@ -26,11 +26,11 @@
#include <linux/random.h> #include <linux/random.h>
#include <stdint.h> #include <stdint.h>
#ifdef HAVE_SYS_AUXV_H #if HAVE_SYS_AUXV_H
# include <sys/auxv.h> # include <sys/auxv.h>
#endif #endif
#ifdef USE_SYS_RANDOM_H #if USE_SYS_RANDOM_H
# include <sys/random.h> # include <sys/random.h>
#else #else
# include <linux/random.h> # 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) { void initialize_srand(void) {
static bool srand_called = false; static bool srand_called = false;
unsigned x; unsigned x;
#ifdef HAVE_SYS_AUXV_H #if HAVE_SYS_AUXV_H
void *auxv; void *auxv;
#endif #endif
if (srand_called) if (srand_called)
return; 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 /* 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 * try to make use of that to seed the pseudo-random generator. It's
* better than nothing... */ * better than nothing... */

View File

@ -26,7 +26,7 @@
#include <sys/un.h> #include <sys/un.h>
#include <syslog.h> #include <syslog.h>
#ifdef HAVE_SELINUX #if HAVE_SELINUX
#include <selinux/context.h> #include <selinux/context.h>
#include <selinux/label.h> #include <selinux/label.h>
#include <selinux/selinux.h> #include <selinux/selinux.h>
@ -40,7 +40,7 @@
#include "time-util.h" #include "time-util.h"
#include "util.h" #include "util.h"
#ifdef HAVE_SELINUX #if HAVE_SELINUX
DEFINE_TRIVIAL_CLEANUP_FUNC(char*, freecon); DEFINE_TRIVIAL_CLEANUP_FUNC(char*, freecon);
DEFINE_TRIVIAL_CLEANUP_FUNC(context_t, context_free); DEFINE_TRIVIAL_CLEANUP_FUNC(context_t, context_free);
@ -54,7 +54,7 @@ static struct selabel_handle *label_hnd = NULL;
#endif #endif
bool mac_selinux_use(void) { bool mac_selinux_use(void) {
#ifdef HAVE_SELINUX #if HAVE_SELINUX
if (cached_use < 0) if (cached_use < 0)
cached_use = is_selinux_enabled() > 0; cached_use = is_selinux_enabled() > 0;
@ -65,7 +65,7 @@ bool mac_selinux_use(void) {
} }
void mac_selinux_retest(void) { void mac_selinux_retest(void) {
#ifdef HAVE_SELINUX #if HAVE_SELINUX
cached_use = -1; cached_use = -1;
#endif #endif
} }
@ -73,7 +73,7 @@ void mac_selinux_retest(void) {
int mac_selinux_init(void) { int mac_selinux_init(void) {
int r = 0; int r = 0;
#ifdef HAVE_SELINUX #if HAVE_SELINUX
usec_t before_timestamp, after_timestamp; usec_t before_timestamp, after_timestamp;
struct mallinfo before_mallinfo, after_mallinfo; struct mallinfo before_mallinfo, after_mallinfo;
@ -110,7 +110,7 @@ int mac_selinux_init(void) {
void mac_selinux_finish(void) { void mac_selinux_finish(void) {
#ifdef HAVE_SELINUX #if HAVE_SELINUX
if (!label_hnd) if (!label_hnd)
return; return;
@ -121,7 +121,7 @@ void mac_selinux_finish(void) {
int mac_selinux_fix(const char *path, bool ignore_enoent, bool ignore_erofs) { int mac_selinux_fix(const char *path, bool ignore_enoent, bool ignore_erofs) {
#ifdef HAVE_SELINUX #if HAVE_SELINUX
struct stat st; struct stat st;
int r; 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) { int mac_selinux_apply(const char *path, const char *label) {
#ifdef HAVE_SELINUX #if HAVE_SELINUX
if (!mac_selinux_use()) if (!mac_selinux_use())
return 0; 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 mac_selinux_get_create_label_from_exe(const char *exe, char **label) {
int r = -EOPNOTSUPP; int r = -EOPNOTSUPP;
#ifdef HAVE_SELINUX #if HAVE_SELINUX
_cleanup_freecon_ char *mycon = NULL, *fcon = NULL; _cleanup_freecon_ char *mycon = NULL, *fcon = NULL;
security_class_t sclass; security_class_t sclass;
@ -220,7 +220,7 @@ int mac_selinux_get_our_label(char **label) {
assert(label); assert(label);
#ifdef HAVE_SELINUX #if HAVE_SELINUX
if (!mac_selinux_use()) if (!mac_selinux_use())
return -EOPNOTSUPP; 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 mac_selinux_get_child_mls_label(int socket_fd, const char *exe, const char *exec_label, char **label) {
int r = -EOPNOTSUPP; int r = -EOPNOTSUPP;
#ifdef HAVE_SELINUX #if HAVE_SELINUX
_cleanup_freecon_ char *mycon = NULL, *peercon = NULL, *fcon = NULL; _cleanup_freecon_ char *mycon = NULL, *peercon = NULL, *fcon = NULL;
_cleanup_context_free_ context_t pcon = NULL, bcon = NULL; _cleanup_context_free_ context_t pcon = NULL, bcon = NULL;
security_class_t sclass; 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) { char* mac_selinux_free(char *label) {
#ifdef HAVE_SELINUX #if HAVE_SELINUX
if (!label) if (!label)
return NULL; return NULL;
@ -312,7 +312,7 @@ char* mac_selinux_free(char *label) {
int mac_selinux_create_file_prepare(const char *path, mode_t mode) { int mac_selinux_create_file_prepare(const char *path, mode_t mode) {
#ifdef HAVE_SELINUX #if HAVE_SELINUX
_cleanup_freecon_ char *filecon = NULL; _cleanup_freecon_ char *filecon = NULL;
int r; 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) { void mac_selinux_create_file_clear(void) {
#ifdef HAVE_SELINUX #if HAVE_SELINUX
PROTECT_ERRNO; PROTECT_ERRNO;
if (!mac_selinux_use()) if (!mac_selinux_use())
@ -367,7 +367,7 @@ void mac_selinux_create_file_clear(void) {
int mac_selinux_create_socket_prepare(const char *label) { int mac_selinux_create_socket_prepare(const char *label) {
#ifdef HAVE_SELINUX #if HAVE_SELINUX
if (!mac_selinux_use()) if (!mac_selinux_use())
return 0; return 0;
@ -386,7 +386,7 @@ int mac_selinux_create_socket_prepare(const char *label) {
void mac_selinux_create_socket_clear(void) { void mac_selinux_create_socket_clear(void) {
#ifdef HAVE_SELINUX #if HAVE_SELINUX
PROTECT_ERRNO; PROTECT_ERRNO;
if (!mac_selinux_use()) 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 */ /* 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; _cleanup_freecon_ char *fcon = NULL;
const struct sockaddr_un *un; const struct sockaddr_un *un;
bool context_changed = false; bool context_changed = false;

View File

@ -35,7 +35,7 @@
#include "string-table.h" #include "string-table.h"
#include "xattr-util.h" #include "xattr-util.h"
#ifdef HAVE_SMACK #if HAVE_SMACK
bool mac_smack_use(void) { bool mac_smack_use(void) {
static int cached_use = -1; static int cached_use = -1;

View File

@ -48,7 +48,7 @@
#include "utf8.h" #include "utf8.h"
#include "util.h" #include "util.h"
#ifdef ENABLE_IDN #if ENABLE_IDN
# define IDN_FLAGS (NI_IDN|NI_IDN_USE_STD3_ASCII_RULES) # define IDN_FLAGS (NI_IDN|NI_IDN_USE_STD3_ASCII_RULES)
#else #else
# define IDN_FLAGS 0 # define IDN_FLAGS 0

View File

@ -1650,7 +1650,7 @@ static EFI_STATUS image_start(EFI_HANDLE parent_image, const Config *config, con
loaded_image->LoadOptions = options; loaded_image->LoadOptions = options;
loaded_image->LoadOptionsSize = (StrLen(loaded_image->LoadOptions)+1) * sizeof(CHAR16); 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 */ /* Try to log any options to the TPM, especially to catch manually edited options */
err = tpm_log_event(SD_TPM_PCR, err = tpm_log_event(SD_TPM_PCR,
(EFI_PHYSICAL_ADDRESS) loaded_image->LoadOptions, (EFI_PHYSICAL_ADDRESS) loaded_image->LoadOptions,

View File

@ -11,7 +11,7 @@
* *
*/ */
#ifdef ENABLE_TPM #if ENABLE_TPM
#include <efi.h> #include <efi.h>
#include <efilib.h> #include <efilib.h>

View File

@ -30,7 +30,7 @@ stub_sources = '''
stub.c stub.c
'''.split() '''.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_cc = get_option('efi-cc')
efi_ld = get_option('efi-ld') efi_ld = get_option('efi-ld')
@ -64,7 +64,7 @@ if have_gnu_efi
efi_conf = configuration_data() efi_conf = configuration_data()
efi_conf.set_quoted('PACKAGE_VERSION', meson.project_version()) efi_conf.set_quoted('PACKAGE_VERSION', meson.project_version())
efi_conf.set_quoted('EFI_MACHINE_TYPE_NAME', EFI_MACHINE_TYPE_NAME) 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_conf.set('SD_TPM_PCR', get_option('tpm-pcrindex'))
efi_config_h = configure_file( efi_config_h = configure_file(

View File

@ -87,7 +87,7 @@ EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) {
line[i] = options[i]; line[i] = options[i];
cmdline = line; cmdline = line;
#ifdef ENABLE_TPM #if ENABLE_TPM
/* Try to log any options to the TPM, especially manually edited options */ /* Try to log any options to the TPM, especially manually edited options */
err = tpm_log_event(SD_TPM_PCR, err = tpm_log_event(SD_TPM_PCR,
(EFI_PHYSICAL_ADDRESS) loaded_image->LoadOptions, (EFI_PHYSICAL_ADDRESS) loaded_image->LoadOptions,

View File

@ -22,7 +22,7 @@
#include "audit-fd.h" #include "audit-fd.h"
#ifdef HAVE_AUDIT #if HAVE_AUDIT
#include <libaudit.h> #include <libaudit.h>
#include <stdbool.h> #include <stdbool.h>

View File

@ -19,7 +19,7 @@
#include <sys/prctl.h> #include <sys/prctl.h>
#ifdef HAVE_SECCOMP #if HAVE_SECCOMP
#include <seccomp.h> #include <seccomp.h>
#endif #endif
@ -42,7 +42,7 @@
#include "path-util.h" #include "path-util.h"
#include "process-util.h" #include "process-util.h"
#include "rlimit-util.h" #include "rlimit-util.h"
#ifdef HAVE_SECCOMP #if HAVE_SECCOMP
#include "seccomp-util.h" #include "seccomp-util.h"
#endif #endif
#include "securebits-util.h" #include "securebits-util.h"
@ -376,7 +376,7 @@ static int property_get_syscall_filter(
_cleanup_strv_free_ char **l = NULL; _cleanup_strv_free_ char **l = NULL;
int r; int r;
#ifdef HAVE_SECCOMP #if HAVE_SECCOMP
Iterator i; Iterator i;
void *id; void *id;
#endif #endif
@ -393,7 +393,7 @@ static int property_get_syscall_filter(
if (r < 0) if (r < 0)
return r; return r;
#ifdef HAVE_SECCOMP #if HAVE_SECCOMP
SET_FOREACH(id, c->syscall_filter, i) { SET_FOREACH(id, c->syscall_filter, i) {
char *name; char *name;
@ -429,7 +429,7 @@ static int property_get_syscall_archs(
_cleanup_strv_free_ char **l = NULL; _cleanup_strv_free_ char **l = NULL;
int r; int r;
#ifdef HAVE_SECCOMP #if HAVE_SECCOMP
Iterator i; Iterator i;
void *id; void *id;
#endif #endif
@ -438,7 +438,7 @@ static int property_get_syscall_archs(
assert(reply); assert(reply);
assert(c); assert(c);
#ifdef HAVE_SECCOMP #if HAVE_SECCOMP
SET_FOREACH(id, c->syscall_archs, i) { SET_FOREACH(id, c->syscall_archs, i) {
const char *name; const char *name;
@ -1185,7 +1185,7 @@ int bus_exec_context_set_transient_property(
return 1; return 1;
#ifdef HAVE_SECCOMP #if HAVE_SECCOMP
} else if (streq(name, "SystemCallFilter")) { } else if (streq(name, "SystemCallFilter")) {
int whitelist; int whitelist;

View File

@ -211,7 +211,7 @@ failed:
return 0; return 0;
} }
#ifdef HAVE_SELINUX #if HAVE_SELINUX
static int mac_selinux_filter(sd_bus_message *message, void *userdata, sd_bus_error *error) { static int mac_selinux_filter(sd_bus_message *message, void *userdata, sd_bus_error *error) {
Manager *m = userdata; Manager *m = userdata;
const char *verb, *path; const char *verb, *path;
@ -535,7 +535,7 @@ static int bus_setup_api_vtables(Manager *m, sd_bus *bus) {
assert(m); assert(m);
assert(bus); assert(bus);
#ifdef HAVE_SELINUX #if HAVE_SELINUX
r = sd_bus_add_filter(bus, NULL, mac_selinux_filter, m); r = sd_bus_add_filter(bus, NULL, mac_selinux_filter, m);
if (r < 0) if (r < 0)
return log_error_errno(r, "Failed to add SELinux access filter: %m"); return log_error_errno(r, "Failed to add SELinux access filter: %m");

View File

@ -37,19 +37,19 @@
#include <unistd.h> #include <unistd.h>
#include <utmpx.h> #include <utmpx.h>
#ifdef HAVE_PAM #if HAVE_PAM
#include <security/pam_appl.h> #include <security/pam_appl.h>
#endif #endif
#ifdef HAVE_SELINUX #if HAVE_SELINUX
#include <selinux/selinux.h> #include <selinux/selinux.h>
#endif #endif
#ifdef HAVE_SECCOMP #if HAVE_SECCOMP
#include <seccomp.h> #include <seccomp.h>
#endif #endif
#ifdef HAVE_APPARMOR #if HAVE_APPARMOR
#include <sys/apparmor.h> #include <sys/apparmor.h>
#endif #endif
@ -57,7 +57,7 @@
#include "af-list.h" #include "af-list.h"
#include "alloc-util.h" #include "alloc-util.h"
#ifdef HAVE_APPARMOR #if HAVE_APPARMOR
#include "apparmor-util.h" #include "apparmor-util.h"
#endif #endif
#include "async.h" #include "async.h"
@ -88,7 +88,7 @@
#include "process-util.h" #include "process-util.h"
#include "rlimit-util.h" #include "rlimit-util.h"
#include "rm-rf.h" #include "rm-rf.h"
#ifdef HAVE_SECCOMP #if HAVE_SECCOMP
#include "seccomp-util.h" #include "seccomp-util.h"
#endif #endif
#include "securebits.h" #include "securebits.h"
@ -1019,7 +1019,7 @@ static int enforce_user(const ExecContext *context, uid_t uid) {
return 0; return 0;
} }
#ifdef HAVE_PAM #if HAVE_PAM
static int null_conv( static int null_conv(
int num_msg, int num_msg,
@ -1043,7 +1043,7 @@ static int setup_pam(
char ***env, char ***env,
int fds[], unsigned n_fds) { int fds[], unsigned n_fds) {
#ifdef HAVE_PAM #if HAVE_PAM
static const struct pam_conv conv = { static const struct pam_conv conv = {
.conv = null_conv, .conv = null_conv,
@ -1318,7 +1318,7 @@ static bool context_has_no_new_privileges(const ExecContext *c) {
c->lock_personality; c->lock_personality;
} }
#ifdef HAVE_SECCOMP #if HAVE_SECCOMP
static bool skip_seccomp_unavailable(const Unit* u, const char* msg) { 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_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_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? */ needs_ambient_hack; /* Do we need to apply the ambient capabilities hack? */
#ifdef HAVE_SELINUX #if HAVE_SELINUX
bool use_selinux = false; bool use_selinux = false;
#endif #endif
#ifdef HAVE_SMACK #if HAVE_SMACK
bool use_smack = false; bool use_smack = false;
#endif #endif
#ifdef HAVE_APPARMOR #if HAVE_APPARMOR
bool use_apparmor = false; bool use_apparmor = false;
#endif #endif
uid_t uid = UID_INVALID; 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 * present. The actual MAC context application will happen later, as late as possible, to avoid
* impacting our own code paths. */ * impacting our own code paths. */
#ifdef HAVE_SELINUX #if HAVE_SELINUX
use_selinux = mac_selinux_use(); use_selinux = mac_selinux_use();
#endif #endif
#ifdef HAVE_SMACK #if HAVE_SMACK
use_smack = mac_smack_use(); use_smack = mac_smack_use();
#endif #endif
#ifdef HAVE_APPARMOR #if HAVE_APPARMOR
use_apparmor = mac_apparmor_use(); use_apparmor = mac_apparmor_use();
#endif #endif
} }
@ -3101,7 +3101,7 @@ static int exec_child(
} }
if (needs_sandboxing) { if (needs_sandboxing) {
#ifdef HAVE_SELINUX #if HAVE_SELINUX
if (use_selinux && params->selinux_context_net && socket_fd >= 0) { 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); r = mac_selinux_get_child_mls_label(socket_fd, command->path, context->selinux_context, &mac_selinux_context_net);
if (r < 0) { 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 * syscalls that are subject to seccomp filtering, hence should probably be applied before the syscalls
* are restricted. */ * are restricted. */
#ifdef HAVE_SELINUX #if HAVE_SELINUX
if (use_selinux) { if (use_selinux) {
char *exec_context = mac_selinux_context_net ?: context->selinux_context; char *exec_context = mac_selinux_context_net ?: context->selinux_context;
@ -3237,7 +3237,7 @@ static int exec_child(
} }
#endif #endif
#ifdef HAVE_SMACK #if HAVE_SMACK
if (use_smack) { if (use_smack) {
r = setup_smack(context, command); r = setup_smack(context, command);
if (r < 0) { if (r < 0) {
@ -3247,7 +3247,7 @@ static int exec_child(
} }
#endif #endif
#ifdef HAVE_APPARMOR #if HAVE_APPARMOR
if (use_apparmor && context->apparmor_profile) { if (use_apparmor && context->apparmor_profile) {
r = aa_change_onexec(context->apparmor_profile); r = aa_change_onexec(context->apparmor_profile);
if (r < 0 && !context->apparmor_profile_ignore) { 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"); 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); r = apply_address_families(unit, context);
if (r < 0) { if (r < 0) {
*exit_status = EXIT_ADDRESS_FAMILIES; *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)); prefix, yes_no(c->lock_personality));
if (c->syscall_filter) { if (c->syscall_filter) {
#ifdef HAVE_SECCOMP #if HAVE_SECCOMP
Iterator j; Iterator j;
void *id; void *id;
bool first = true; bool first = true;
@ -4131,7 +4131,7 @@ void exec_context_dump(ExecContext *c, FILE* f, const char *prefix) {
if (!c->syscall_whitelist) if (!c->syscall_whitelist)
fputc('~', f); fputc('~', f);
#ifdef HAVE_SECCOMP #if HAVE_SECCOMP
SET_FOREACH(id, c->syscall_filter, j) { SET_FOREACH(id, c->syscall_filter, j) {
_cleanup_free_ char *name = NULL; _cleanup_free_ char *name = NULL;
@ -4149,7 +4149,7 @@ void exec_context_dump(ExecContext *c, FILE* f, const char *prefix) {
} }
if (c->syscall_archs) { if (c->syscall_archs) {
#ifdef HAVE_SECCOMP #if HAVE_SECCOMP
Iterator j; Iterator j;
void *id; void *id;
#endif #endif
@ -4158,7 +4158,7 @@ void exec_context_dump(ExecContext *c, FILE* f, const char *prefix) {
"%sSystemCallArchitectures:", "%sSystemCallArchitectures:",
prefix); prefix);
#ifdef HAVE_SECCOMP #if HAVE_SECCOMP
SET_FOREACH(id, c->syscall_archs, j) SET_FOREACH(id, c->syscall_archs, j)
fprintf(f, " %s", strna(seccomp_arch_to_string(PTR_TO_UINT32(id) - 1))); fprintf(f, " %s", strna(seccomp_arch_to_string(PTR_TO_UINT32(id) - 1)));
#endif #endif

View File

@ -33,7 +33,7 @@
#define IMA_POLICY_PATH "/etc/ima/ima-policy" #define IMA_POLICY_PATH "/etc/ima/ima-policy"
int ima_setup(void) { int ima_setup(void) {
#ifdef HAVE_IMA #if HAVE_IMA
_cleanup_fclose_ FILE *input = NULL; _cleanup_fclose_ FILE *input = NULL;
_cleanup_close_ int imafd = -1; _cleanup_close_ int imafd = -1;
unsigned lineno = 0; unsigned lineno = 0;

View File

@ -21,7 +21,7 @@
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
#ifdef HAVE_KMOD #if HAVE_KMOD
#include <libkmod.h> #include <libkmod.h>
#endif #endif
@ -33,7 +33,7 @@
#include "macro.h" #include "macro.h"
#include "string-util.h" #include "string-util.h"
#ifdef HAVE_KMOD #if HAVE_KMOD
static void systemd_kmod_log( static void systemd_kmod_log(
void *data, void *data,
int priority, int priority,
@ -85,7 +85,7 @@ static bool has_virtio_rng(void) {
#endif #endif
int kmod_setup(void) { int kmod_setup(void) {
#ifdef HAVE_KMOD #if HAVE_KMOD
static const struct { static const struct {
const char *module; const char *module;
@ -103,7 +103,7 @@ int kmod_setup(void) {
/* this should never be a module */ /* this should never be a module */
{ "unix", "/proc/net/unix", true, true, NULL }, { "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 */ /* netfilter is needed by networkd, nspawn among others, and cannot be autoloaded */
{ "ip_tables", "/proc/net/ip_tables_names", false, false, NULL }, { "ip_tables", "/proc/net/ip_tables_names", false, false, NULL },
#endif #endif

View File

@ -22,7 +22,7 @@
#include <fcntl.h> #include <fcntl.h>
#include <linux/fs.h> #include <linux/fs.h>
#include <linux/oom.h> #include <linux/oom.h>
#ifdef HAVE_SECCOMP #if HAVE_SECCOMP
#include <seccomp.h> #include <seccomp.h>
#endif #endif
#include <sched.h> #include <sched.h>
@ -54,7 +54,7 @@
#include "path-util.h" #include "path-util.h"
#include "process-util.h" #include "process-util.h"
#include "rlimit-util.h" #include "rlimit-util.h"
#ifdef HAVE_SECCOMP #if HAVE_SECCOMP
#include "seccomp-util.h" #include "seccomp-util.h"
#endif #endif
#include "securebits.h" #include "securebits.h"
@ -1246,7 +1246,7 @@ int config_parse_limit(
return 0; return 0;
} }
#ifdef HAVE_SYSV_COMPAT #if HAVE_SYSV_COMPAT
int config_parse_sysv_priority(const char *unit, int config_parse_sysv_priority(const char *unit,
const char *filename, const char *filename,
unsigned line, unsigned line,
@ -2643,7 +2643,7 @@ int config_parse_documentation(const char *unit,
return r; return r;
} }
#ifdef HAVE_SECCOMP #if HAVE_SECCOMP
static int syscall_filter_parse_one( static int syscall_filter_parse_one(
const char *unit, const char *unit,
@ -4504,7 +4504,7 @@ void unit_dump_config_items(FILE *f) {
const ConfigParserCallback callback; const ConfigParserCallback callback;
const char *rvalue; const char *rvalue;
} table[] = { } 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" }, { config_parse_warn_compat, "NOTSUPPORTED" },
#endif #endif
{ config_parse_int, "INTEGER" }, { config_parse_int, "INTEGER" },
@ -4537,7 +4537,7 @@ void unit_dump_config_items(FILE *f) {
{ config_parse_exec, "PATH [ARGUMENT [...]]" }, { config_parse_exec, "PATH [ARGUMENT [...]]" },
{ config_parse_service_type, "SERVICETYPE" }, { config_parse_service_type, "SERVICETYPE" },
{ config_parse_service_restart, "SERVICERESTART" }, { config_parse_service_restart, "SERVICERESTART" },
#ifdef HAVE_SYSV_COMPAT #if HAVE_SYSV_COMPAT
{ config_parse_sysv_priority, "SYSVPRIORITY" }, { config_parse_sysv_priority, "SYSVPRIORITY" },
#endif #endif
{ config_parse_kill_mode, "KILLMODE" }, { config_parse_kill_mode, "KILLMODE" },
@ -4567,7 +4567,7 @@ void unit_dump_config_items(FILE *f) {
{ config_parse_set_status, "STATUS" }, { config_parse_set_status, "STATUS" },
{ config_parse_service_sockets, "SOCKETS" }, { config_parse_service_sockets, "SOCKETS" },
{ config_parse_environ, "ENVIRON" }, { config_parse_environ, "ENVIRON" },
#ifdef HAVE_SECCOMP #if HAVE_SECCOMP
{ config_parse_syscall_filter, "SYSCALLS" }, { config_parse_syscall_filter, "SYSCALLS" },
{ config_parse_syscall_archs, "ARCHS" }, { config_parse_syscall_archs, "ARCHS" },
{ config_parse_syscall_errno, "ERRNO" }, { config_parse_syscall_errno, "ERRNO" },
@ -4587,7 +4587,7 @@ void unit_dump_config_items(FILE *f) {
{ config_parse_blockio_device_weight, "DEVICEWEIGHT" }, { config_parse_blockio_device_weight, "DEVICEWEIGHT" },
{ config_parse_long, "LONG" }, { config_parse_long, "LONG" },
{ config_parse_socket_service, "SERVICE" }, { config_parse_socket_service, "SERVICE" },
#ifdef HAVE_SELINUX #if HAVE_SELINUX
{ config_parse_exec_selinux_context, "LABEL" }, { config_parse_exec_selinux_context, "LABEL" },
#endif #endif
{ config_parse_job_mode, "MODE" }, { config_parse_job_mode, "MODE" },

View File

@ -28,10 +28,10 @@
#include <sys/reboot.h> #include <sys/reboot.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <unistd.h> #include <unistd.h>
#ifdef HAVE_SECCOMP #if HAVE_SECCOMP
#include <seccomp.h> #include <seccomp.h>
#endif #endif
#ifdef HAVE_VALGRIND_VALGRIND_H #if HAVE_VALGRIND_VALGRIND_H
#include <valgrind/valgrind.h> #include <valgrind/valgrind.h>
#endif #endif
@ -74,7 +74,7 @@
#include "process-util.h" #include "process-util.h"
#include "raw-clone.h" #include "raw-clone.h"
#include "rlimit-util.h" #include "rlimit-util.h"
#ifdef HAVE_SECCOMP #if HAVE_SECCOMP
#include "seccomp-util.h" #include "seccomp-util.h"
#endif #endif
#include "selinux-setup.h" #include "selinux-setup.h"
@ -717,7 +717,7 @@ static int parse_config_file(void) {
{ "Manager", "RuntimeWatchdogSec", config_parse_sec, 0, &arg_runtime_watchdog }, { "Manager", "RuntimeWatchdogSec", config_parse_sec, 0, &arg_runtime_watchdog },
{ "Manager", "ShutdownWatchdogSec", config_parse_sec, 0, &arg_shutdown_watchdog }, { "Manager", "ShutdownWatchdogSec", config_parse_sec, 0, &arg_shutdown_watchdog },
{ "Manager", "CapabilityBoundingSet", config_parse_capability_set, 0, &arg_capability_bounding_set }, { "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 }, { "Manager", "SystemCallArchitectures", config_parse_syscall_archs, 0, &arg_syscall_archs },
#endif #endif
{ "Manager", "TimerSlackNSec", config_parse_nsec, 0, &arg_timer_slack_nsec }, { "Manager", "TimerSlackNSec", config_parse_nsec, 0, &arg_timer_slack_nsec },
@ -1264,7 +1264,7 @@ oom:
} }
static int enforce_syscall_archs(Set *archs) { static int enforce_syscall_archs(Set *archs) {
#ifdef HAVE_SECCOMP #if HAVE_SECCOMP
int r; int r;
if (!is_seccomp_available()) 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); struct rlimit saved_rlimit_nofile = RLIMIT_MAKE_CONST(0), saved_rlimit_memlock = RLIMIT_MAKE_CONST((rlim_t) -1);
const char *error_message = NULL; const char *error_message = NULL;
#ifdef HAVE_SYSV_COMPAT #if HAVE_SYSV_COMPAT
if (getpid_cached() != 1 && strstr(program_invocation_short_name, "init")) { if (getpid_cached() != 1 && strstr(program_invocation_short_name, "init")) {
/* This is compatibility support for SysV, where /* This is compatibility support for SysV, where
* calling init as a user is identical to telinit. */ * calling init as a user is identical to telinit. */
@ -2172,7 +2172,7 @@ finish:
arg_serialization = safe_fclose(arg_serialization); arg_serialization = safe_fclose(arg_serialization);
fds = fdset_free(fds); 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 /* If we are PID 1 and running under valgrind, then let's exit
* here explicitly. valgrind will only generate nice output on * here explicitly. valgrind will only generate nice output on
* exit(), not on exec(), hence let's do the former not the * exit(), not on exec(), hence let's do the former not the

View File

@ -30,7 +30,7 @@
#include <sys/wait.h> #include <sys/wait.h>
#include <unistd.h> #include <unistd.h>
#ifdef HAVE_AUDIT #if HAVE_AUDIT
#include <libaudit.h> #include <libaudit.h>
#endif #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_timeout_stop_usec = DEFAULT_TIMEOUT_USEC;
m->default_restart_usec = DEFAULT_RESTART_USEC; m->default_restart_usec = DEFAULT_RESTART_USEC;
#ifdef ENABLE_EFI #if ENABLE_EFI
if (MANAGER_IS_SYSTEM(m) && detect_container() <= 0) if (MANAGER_IS_SYSTEM(m) && detect_container() <= 0)
boot_timestamps(&m->userspace_timestamp, &m->firmware_timestamp, &m->loader_timestamp); boot_timestamps(&m->userspace_timestamp, &m->firmware_timestamp, &m->loader_timestamp);
#endif #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) { void manager_send_unit_audit(Manager *m, Unit *u, int type, bool success) {
#ifdef HAVE_AUDIT #if HAVE_AUDIT
_cleanup_free_ char *p = NULL; _cleanup_free_ char *p = NULL;
const char *msg; const char *msg;
int audit_fd, r; int audit_fd, r;

View File

@ -64,7 +64,7 @@ typedef struct MountPoint {
* fourth (securityfs) is needed by IMA to load a custom policy. The * fourth (securityfs) is needed by IMA to load a custom policy. The
* other ones we can delay until SELinux and IMA are loaded. When * 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. */ * SMACK is enabled we need smackfs, too, so it's a fifth one. */
#ifdef HAVE_SMACK #if HAVE_SMACK
#define N_EARLY_MOUNT 5 #define N_EARLY_MOUNT 5
#else #else
#define N_EARLY_MOUNT 4 #define N_EARLY_MOUNT 4
@ -79,7 +79,7 @@ static const MountPoint mount_table[] = {
NULL, MNT_FATAL|MNT_IN_CONTAINER }, NULL, MNT_FATAL|MNT_IN_CONTAINER },
{ "securityfs", "/sys/kernel/security", "securityfs", NULL, MS_NOSUID|MS_NOEXEC|MS_NODEV, { "securityfs", "/sys/kernel/security", "securityfs", NULL, MS_NOSUID|MS_NOEXEC|MS_NODEV,
NULL, MNT_NONE }, NULL, MNT_NONE },
#ifdef HAVE_SMACK #if HAVE_SMACK
{ "smackfs", "/sys/fs/smackfs", "smackfs", "smackfsdef=*", MS_NOSUID|MS_NOEXEC|MS_NODEV, { "smackfs", "/sys/fs/smackfs", "smackfs", "smackfsdef=*", MS_NOSUID|MS_NOEXEC|MS_NODEV,
mac_smack_use, MNT_FATAL }, mac_smack_use, MNT_FATAL },
{ "tmpfs", "/dev/shm", "tmpfs", "mode=1777,smackfsroot=*", MS_NOSUID|MS_NODEV|MS_STRICTATIME, { "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 }, NULL, MNT_FATAL|MNT_IN_CONTAINER },
{ "devpts", "/dev/pts", "devpts", "mode=620,gid=" STRINGIFY(TTY_GID), MS_NOSUID|MS_NOEXEC, { "devpts", "/dev/pts", "devpts", "mode=620,gid=" STRINGIFY(TTY_GID), MS_NOSUID|MS_NOEXEC,
NULL, MNT_IN_CONTAINER }, NULL, MNT_IN_CONTAINER },
#ifdef HAVE_SMACK #if HAVE_SMACK
{ "tmpfs", "/run", "tmpfs", "mode=755,smackfsroot=*", MS_NOSUID|MS_NODEV|MS_STRICTATIME, { "tmpfs", "/run", "tmpfs", "mode=755,smackfsroot=*", MS_NOSUID|MS_NODEV|MS_STRICTATIME,
mac_smack_use, MNT_FATAL }, mac_smack_use, MNT_FATAL },
#endif #endif
@ -111,7 +111,7 @@ static const MountPoint mount_table[] = {
cg_is_legacy_wanted, MNT_FATAL|MNT_IN_CONTAINER }, cg_is_legacy_wanted, MNT_FATAL|MNT_IN_CONTAINER },
{ "pstore", "/sys/fs/pstore", "pstore", NULL, MS_NOSUID|MS_NOEXEC|MS_NODEV, { "pstore", "/sys/fs/pstore", "pstore", NULL, MS_NOSUID|MS_NOEXEC|MS_NODEV,
NULL, MNT_NONE }, NULL, MNT_NONE },
#ifdef ENABLE_EFI #if ENABLE_EFI
{ "efivarfs", "/sys/firmware/efi/efivars", "efivarfs", NULL, MS_NOSUID|MS_NOEXEC|MS_NODEV, { "efivarfs", "/sys/firmware/efi/efivars", "efivarfs", NULL, MS_NOSUID|MS_NOEXEC|MS_NODEV,
is_efi_boot, MNT_NONE }, is_efi_boot, MNT_NONE },
#endif #endif
@ -336,7 +336,7 @@ int mount_cgroup_controllers(char ***join_controllers) {
return 0; return 0;
} }
#if defined(HAVE_SELINUX) || defined(HAVE_SMACK) #if HAVE_SELINUX || HAVE_SMACK
static int nftw_cb( static int nftw_cb(
const char *fpath, const char *fpath,
const struct stat *sb, const struct stat *sb,
@ -367,7 +367,7 @@ int mount_setup(bool loaded_policy) {
if (r < 0) if (r < 0)
return r; 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 /* Nodes in devtmpfs and /run need to be manually updated for
* the appropriate labels, after mounting. The other virtual * the appropriate labels, after mounting. The other virtual
* API file systems like /sys and /proc do not need that, they * API file systems like /sys and /proc do not need that, they

View File

@ -107,7 +107,7 @@ static const MountEntry protect_kernel_tunables_table[] = {
/* ProtectKernelModules= option */ /* ProtectKernelModules= option */
static const MountEntry protect_kernel_modules_table[] = { static const MountEntry protect_kernel_modules_table[] = {
#ifdef HAVE_SPLIT_USR #if HAVE_SPLIT_USR
{ "/lib/modules", INACCESSIBLE, true }, { "/lib/modules", INACCESSIBLE, true },
#endif #endif
{ "/usr/lib/modules", INACCESSIBLE, true }, { "/usr/lib/modules", INACCESSIBLE, true },

View File

@ -19,13 +19,13 @@
#include "selinux-access.h" #include "selinux-access.h"
#ifdef HAVE_SELINUX #if HAVE_SELINUX
#include <errno.h> #include <errno.h>
#include <selinux/avc.h> #include <selinux/avc.h>
#include <selinux/selinux.h> #include <selinux/selinux.h>
#include <stdio.h> #include <stdio.h>
#ifdef HAVE_AUDIT #if HAVE_AUDIT
#include <libaudit.h> #include <libaudit.h>
#endif #endif
@ -112,7 +112,7 @@ _printf_(2, 3) static int log_callback(int type, const char *fmt, ...) {
va_list ap; va_list ap;
const char *fmt2; const char *fmt2;
#ifdef HAVE_AUDIT #if HAVE_AUDIT
int fd; int fd;
fd = get_audit_fd(); fd = get_audit_fd();

View File

@ -26,7 +26,7 @@
int mac_selinux_generic_access_check(sd_bus_message *message, const char *path, const char *permission, sd_bus_error *error); 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) \ #define mac_selinux_access_check(message, permission, error) \
mac_selinux_generic_access_check((message), NULL, (permission), (error)) mac_selinux_generic_access_check((message), NULL, (permission), (error))

View File

@ -21,7 +21,7 @@
#include <stdio.h> #include <stdio.h>
#include <unistd.h> #include <unistd.h>
#ifdef HAVE_SELINUX #if HAVE_SELINUX
#include <selinux/selinux.h> #include <selinux/selinux.h>
#endif #endif
@ -32,7 +32,7 @@
#include "string-util.h" #include "string-util.h"
#include "util.h" #include "util.h"
#ifdef HAVE_SELINUX #if HAVE_SELINUX
_printf_(2,3) _printf_(2,3)
static int null_log(int type, const char *fmt, ...) { static int null_log(int type, const char *fmt, ...) {
return 0; return 0;
@ -41,7 +41,7 @@ static int null_log(int type, const char *fmt, ...) {
int mac_selinux_setup(bool *loaded_policy) { int mac_selinux_setup(bool *loaded_policy) {
#ifdef HAVE_SELINUX #if HAVE_SELINUX
int enforce = 0; int enforce = 0;
usec_t before_load, after_load; usec_t before_load, after_load;
char *con; char *con;

View File

@ -36,7 +36,7 @@
#include "string-util.h" #include "string-util.h"
#include "util.h" #include "util.h"
#ifdef HAVE_SMACK #if HAVE_SMACK
static int write_access2_rules(const char* srcdir) { static int write_access2_rules(const char* srcdir) {
_cleanup_close_ int load2_fd = -1, change_fd = -1; _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) { int mac_smack_setup(bool *loaded_policy) {
#ifdef HAVE_SMACK #if HAVE_SMACK
int r; int r;

View File

@ -375,7 +375,7 @@ static int delete_dm(dev_t devnum) {
static bool nonunmountable_path(const char *path) { static bool nonunmountable_path(const char *path) {
return path_equal(path, "/") return path_equal(path, "/")
#ifndef HAVE_SPLIT_USR #if ! HAVE_SPLIT_USR
|| path_equal(path, "/usr") || path_equal(path, "/usr")
#endif #endif
|| path_startswith(path, "/run/initramfs"); || path_startswith(path, "/run/initramfs");

View File

@ -23,7 +23,7 @@
#include <sys/xattr.h> #include <sys/xattr.h>
#include <unistd.h> #include <unistd.h>
#ifdef HAVE_ELFUTILS #if HAVE_ELFUTILS
#include <dwarf.h> #include <dwarf.h>
#include <elfutils/libdwfl.h> #include <elfutils/libdwfl.h>
#endif #endif
@ -156,7 +156,7 @@ static inline uint64_t storage_size_max(void) {
static int fix_acl(int fd, uid_t uid) { static int fix_acl(int fd, uid_t uid) {
#ifdef HAVE_ACL #if HAVE_ACL
_cleanup_(acl_freep) acl_t acl = NULL; _cleanup_(acl_freep) acl_t acl = NULL;
acl_entry_t entry; acl_entry_t entry;
acl_permset_t permset; acl_permset_t permset;
@ -393,7 +393,7 @@ static int save_external_coredump(
goto fail; 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 we will remove the coredump anyway, do not compress. */
if (arg_compress && !maybe_remove_external_coredump(NULL, st.st_size)) { if (arg_compress && !maybe_remove_external_coredump(NULL, st.st_size)) {
@ -765,7 +765,7 @@ static int submit_coredump(
if (r < 0) if (r < 0)
return log_error_errno(r, "Failed to drop privileges: %m"); 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 */ /* Try to get a strack trace if we can */
if (coredump_size <= arg_process_size_max) { if (coredump_size <= arg_process_size_max) {
_cleanup_free_ char *stacktrace = NULL; _cleanup_free_ char *stacktrace = NULL;

View File

@ -799,7 +799,7 @@ static int save_core(sd_journal *j, FILE *file, char **path, bool *unlink_temp)
} }
if (filename) { if (filename) {
#if defined(HAVE_XZ) || defined(HAVE_LZ4) #if HAVE_XZ || HAVE_LZ4
_cleanup_close_ int fdf; _cleanup_close_ int fdf;
fdf = open(filename, O_RDONLY | O_CLOEXEC); fdf = open(filename, O_RDONLY | O_CLOEXEC);

View File

@ -4,7 +4,7 @@ systemd_coredump_sources = files('''
coredump-vacuum.h coredump-vacuum.h
'''.split()) '''.split())
if conf.get('HAVE_ELFUTILS', false) if conf.get('HAVE_ELFUTILS') == 1
systemd_coredump_sources += files(['stacktrace.c', systemd_coredump_sources += files(['stacktrace.c',
'stacktrace.h']) 'stacktrace.h'])
endif endif

View File

@ -49,7 +49,7 @@ static const char prefixes[] =
"/usr/local/share\0" "/usr/local/share\0"
"/usr/lib\0" "/usr/lib\0"
"/usr/share\0" "/usr/share\0"
#ifdef HAVE_SPLIT_USR #if HAVE_SPLIT_USR
"/lib\0" "/lib\0"
#endif #endif
; ;
@ -392,7 +392,7 @@ static int enumerate_dir(
} }
static int should_skip_prefix(const char* p) { static int should_skip_prefix(const char* p) {
#ifdef HAVE_SPLIT_USR #if HAVE_SPLIT_USR
int r; int r;
_cleanup_free_ char *target = NULL; _cleanup_free_ char *target = NULL;

View File

@ -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) { else if (streq(key, "fastboot") && !value) {
log_warning("Please pass 'fsck.mode=skip' rather than 'fastboot' on the kernel command line."); log_warning("Please pass 'fsck.mode=skip' rather than 'fastboot' on the kernel command line.");
arg_skip = true; 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) { static void test_files(void) {
#ifdef HAVE_SYSV_COMPAT #if HAVE_SYSV_COMPAT
if (access("/fastboot", F_OK) >= 0) { 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."); log_error("Please pass 'fsck.mode=skip' on the kernel command line rather than creating /fastboot on the root file system.");
arg_skip = true; arg_skip = true;

View File

@ -323,7 +323,7 @@ static int add_swap(const char *path) {
return generator_add_symlink(arg_dest, SPECIAL_SWAP_TARGET, "wants", name); return generator_add_symlink(arg_dest, SPECIAL_SWAP_TARGET, "wants", name);
} }
#ifdef ENABLE_EFI #if ENABLE_EFI
static int add_automount( static int add_automount(
const char *id, const char *id,
const char *what, const char *what,
@ -612,7 +612,7 @@ static int parse_proc_cmdline_item(const char *key, const char *value, void *dat
return 0; return 0;
} }
#ifdef ENABLE_EFI #if ENABLE_EFI
static int add_root_cryptsetup(void) { 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 /* 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) { static int add_root_mount(void) {
#ifdef ENABLE_EFI #if ENABLE_EFI
int r; int r;
if (!is_efi_boot()) { if (!is_efi_boot()) {

View File

@ -1,4 +1,4 @@
if conf.get('ENABLE_HOSTNAMED', false) if conf.get('ENABLE_HOSTNAMED') == 1
install_data('org.freedesktop.hostname1.conf', install_data('org.freedesktop.hostname1.conf',
install_dir : dbuspolicydir) install_dir : dbuspolicydir)
install_data('org.freedesktop.hostname1.service', install_data('org.freedesktop.hostname1.service',

View File

@ -48,7 +48,7 @@ systemd_export_sources = files('''
import-compress.h import-compress.h
'''.split()) '''.split())
if conf.get('ENABLE_IMPORTD', false) if conf.get('ENABLE_IMPORTD') == 1
install_data('org.freedesktop.import1.conf', install_data('org.freedesktop.import1.conf',
install_dir : dbuspolicydir) install_dir : dbuspolicydir)
install_data('org.freedesktop.import1.service', install_data('org.freedesktop.import1.service',

View File

@ -946,7 +946,7 @@ static int parse_argv(int argc, char *argv[]) {
break; break;
case ARG_TRUST: case ARG_TRUST:
#ifdef HAVE_GNUTLS #if HAVE_GNUTLS
if (arg_trust_pem) { if (arg_trust_pem) {
log_error("CA certificate file specified twice"); log_error("CA certificate file specified twice");
return -EINVAL; return -EINVAL;

View File

@ -1384,7 +1384,7 @@ static int parse_argv(int argc, char *argv[]) {
if (streq(optarg, "all")) if (streq(optarg, "all"))
arg_trust_all = true; arg_trust_all = true;
else { else {
#ifdef HAVE_GNUTLS #if HAVE_GNUTLS
arg_trust = strdup(optarg); arg_trust = strdup(optarg);
if (!arg_trust) if (!arg_trust)
return log_oom(); return log_oom();
@ -1442,7 +1442,7 @@ static int parse_argv(int argc, char *argv[]) {
break; break;
case ARG_GNUTLS_LOG: { case ARG_GNUTLS_LOG: {
#ifdef HAVE_GNUTLS #if HAVE_GNUTLS
const char* p = optarg; const char* p = optarg;
for (;;) { for (;;) {
_cleanup_free_ char *word = NULL; _cleanup_free_ char *word = NULL;

View File

@ -21,7 +21,7 @@ systemd_journal_gatewayd_sources = files('''
microhttpd-util.c microhttpd-util.c
'''.split()) '''.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( journal_upload_conf = configure_file(
input : 'journal-upload.conf.in', input : 'journal-upload.conf.in',
output : 'journal-upload.conf', output : 'journal-upload.conf',
@ -30,7 +30,7 @@ if conf.get('ENABLE_REMOTE', false) and conf.get('HAVE_LIBCURL', false)
install_dir : pkgsysconfdir) install_dir : pkgsysconfdir)
endif 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( journal_remote_conf = configure_file(
input : 'journal-remote.conf.in', input : 'journal-remote.conf.in',
output : 'journal-remote.conf', output : 'journal-remote.conf',

View File

@ -22,7 +22,7 @@
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#ifdef HAVE_GNUTLS #if HAVE_GNUTLS
#include <gnutls/gnutls.h> #include <gnutls/gnutls.h>
#include <gnutls/x509.h> #include <gnutls/x509.h>
#endif #endif
@ -115,7 +115,7 @@ int mhd_respondf(struct MHD_Connection *connection,
return mhd_respond_internal(connection, code, m, r, MHD_RESPMEM_MUST_FREE); return mhd_respond_internal(connection, code, m, r, MHD_RESPMEM_MUST_FREE);
} }
#ifdef HAVE_GNUTLS #if HAVE_GNUTLS
static struct { static struct {
const char *const names[4]; const char *const names[4];

View File

@ -19,7 +19,7 @@
#include <stdio.h> #include <stdio.h>
#include <linux/audit.h> #include <linux/audit.h>
#ifdef HAVE_AUDIT #if HAVE_AUDIT
# include <libaudit.h> # include <libaudit.h>
#endif #endif

View File

@ -23,11 +23,11 @@
#include <sys/mman.h> #include <sys/mman.h>
#include <unistd.h> #include <unistd.h>
#ifdef HAVE_XZ #if HAVE_XZ
#include <lzma.h> #include <lzma.h>
#endif #endif
#ifdef HAVE_LZ4 #if HAVE_LZ4
#include <lz4.h> #include <lz4.h>
#include <lz4frame.h> #include <lz4frame.h>
#endif #endif
@ -43,7 +43,7 @@
#include "string-util.h" #include "string-util.h"
#include "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_compressionContext_t, LZ4F_freeCompressionContext);
DEFINE_TRIVIAL_CLEANUP_FUNC(LZ4F_decompressionContext_t, LZ4F_freeDecompressionContext); DEFINE_TRIVIAL_CLEANUP_FUNC(LZ4F_decompressionContext_t, LZ4F_freeDecompressionContext);
#endif #endif
@ -59,7 +59,7 @@ DEFINE_STRING_TABLE_LOOKUP(object_compressed, int);
int compress_blob_xz(const void *src, uint64_t src_size, int compress_blob_xz(const void *src, uint64_t src_size,
void *dst, size_t dst_alloc_size, size_t *dst_size) { void *dst, size_t dst_alloc_size, size_t *dst_size) {
#ifdef HAVE_XZ #if HAVE_XZ
static const lzma_options_lzma opt = { static const lzma_options_lzma opt = {
1u << 20u, NULL, 0, LZMA_LC_DEFAULT, LZMA_LP_DEFAULT, 1u << 20u, NULL, 0, LZMA_LC_DEFAULT, LZMA_LP_DEFAULT,
LZMA_PB_DEFAULT, LZMA_MODE_FAST, 128, LZMA_MF_HC3, 4 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, int compress_blob_lz4(const void *src, uint64_t src_size,
void *dst, size_t dst_alloc_size, size_t *dst_size) { void *dst, size_t dst_alloc_size, size_t *dst_size) {
#ifdef HAVE_LZ4 #if HAVE_LZ4
int r; int r;
assert(src); 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, 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) { 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; _cleanup_(lzma_end) lzma_stream s = LZMA_STREAM_INIT;
lzma_ret ret; lzma_ret ret;
size_t space; 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, 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) { void **dst, size_t *dst_alloc_size, size_t* dst_size, size_t dst_max) {
#ifdef HAVE_LZ4 #if HAVE_LZ4
char* out; char* out;
int r, size; /* LZ4 uses int for size */ 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, const void *prefix, size_t prefix_len,
uint8_t extra) { uint8_t extra) {
#ifdef HAVE_XZ #if HAVE_XZ
_cleanup_(lzma_end) lzma_stream s = LZMA_STREAM_INIT; _cleanup_(lzma_end) lzma_stream s = LZMA_STREAM_INIT;
lzma_ret ret; lzma_ret ret;
@ -307,7 +307,7 @@ int decompress_startswith_lz4(const void *src, uint64_t src_size,
void **buffer, size_t *buffer_size, void **buffer, size_t *buffer_size,
const void *prefix, size_t prefix_len, const void *prefix, size_t prefix_len,
uint8_t extra) { uint8_t extra) {
#ifdef HAVE_LZ4 #if HAVE_LZ4
/* Checks whether the decompressed blob starts with the /* Checks whether the decompressed blob starts with the
* mentioned prefix. The byte extra needs to follow the * mentioned prefix. The byte extra needs to follow the
* prefix */ * prefix */
@ -372,7 +372,7 @@ int decompress_startswith(int compression,
} }
int compress_stream_xz(int fdf, int fdt, uint64_t max_bytes) { 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; _cleanup_(lzma_end) lzma_stream s = LZMA_STREAM_INIT;
lzma_ret ret; lzma_ret ret;
uint8_t buf[BUFSIZ], out[BUFSIZ]; 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) { int compress_stream_lz4(int fdf, int fdt, uint64_t max_bytes) {
#ifdef HAVE_LZ4 #if HAVE_LZ4
LZ4F_errorCode_t c; LZ4F_errorCode_t c;
_cleanup_(LZ4F_freeCompressionContextp) LZ4F_compressionContext_t ctx = NULL; _cleanup_(LZ4F_freeCompressionContextp) LZ4F_compressionContext_t ctx = NULL;
_cleanup_free_ char *buf = 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) { 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; _cleanup_(lzma_end) lzma_stream s = LZMA_STREAM_INIT;
lzma_ret ret; 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) { int decompress_stream_lz4(int in, int out, uint64_t max_bytes) {
#ifdef HAVE_LZ4 #if HAVE_LZ4
size_t c; size_t c;
_cleanup_(LZ4F_freeDecompressionContextp) LZ4F_decompressionContext_t ctx = NULL; _cleanup_(LZ4F_freeDecompressionContextp) LZ4F_decompressionContext_t ctx = NULL;
_cleanup_free_ char *buf = NULL; _cleanup_free_ char *buf = NULL;

View File

@ -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, static inline int compress_blob(const void *src, uint64_t src_size,
void *dst, size_t dst_alloc_size, size_t *dst_size) { void *dst, size_t dst_alloc_size, size_t *dst_size) {
int r; int r;
#ifdef HAVE_LZ4 #if HAVE_LZ4
r = compress_blob_lz4(src, src_size, dst, dst_alloc_size, dst_size); r = compress_blob_lz4(src, src_size, dst, dst_alloc_size, dst_size);
if (r == 0) if (r == 0)
return OBJECT_COMPRESSED_LZ4; 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_xz(int fdf, int fdt, uint64_t max_size);
int decompress_stream_lz4(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 compress_stream compress_stream_lz4
# define COMPRESSED_EXT ".lz4" # define COMPRESSED_EXT ".lz4"
#else #else

View File

@ -162,11 +162,11 @@ enum {
#define HEADER_INCOMPATIBLE_ANY (HEADER_INCOMPATIBLE_COMPRESSED_XZ|HEADER_INCOMPATIBLE_COMPRESSED_LZ4) #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 # define HEADER_INCOMPATIBLE_SUPPORTED HEADER_INCOMPATIBLE_ANY
#elif defined(HAVE_XZ) #elif HAVE_XZ
# define HEADER_INCOMPATIBLE_SUPPORTED HEADER_INCOMPATIBLE_COMPRESSED_XZ # define HEADER_INCOMPATIBLE_SUPPORTED HEADER_INCOMPATIBLE_COMPRESSED_XZ
#elif defined(HAVE_LZ4) #elif HAVE_LZ4
# define HEADER_INCOMPATIBLE_SUPPORTED HEADER_INCOMPATIBLE_COMPRESSED_LZ4 # define HEADER_INCOMPATIBLE_SUPPORTED HEADER_INCOMPATIBLE_COMPRESSED_LZ4
#else #else
# define HEADER_INCOMPATIBLE_SUPPORTED 0 # define HEADER_INCOMPATIBLE_SUPPORTED 0
@ -177,7 +177,7 @@ enum {
}; };
#define HEADER_COMPATIBLE_ANY HEADER_COMPATIBLE_SEALED #define HEADER_COMPATIBLE_ANY HEADER_COMPATIBLE_SEALED
#ifdef HAVE_GCRYPT #if HAVE_GCRYPT
# define HEADER_COMPATIBLE_SUPPORTED HEADER_COMPATIBLE_SEALED # define HEADER_COMPATIBLE_SUPPORTED HEADER_COMPATIBLE_SEALED
#else #else
# define HEADER_COMPATIBLE_SUPPORTED 0 # define HEADER_COMPATIBLE_SUPPORTED 0

View File

@ -331,7 +331,7 @@ bool journal_file_is_offlining(JournalFile *f) {
JournalFile* journal_file_close(JournalFile *f) { JournalFile* journal_file_close(JournalFile *f) {
assert(f); assert(f);
#ifdef HAVE_GCRYPT #if HAVE_GCRYPT
/* Write the final tag */ /* Write the final tag */
if (f->seal && f->writable) { if (f->seal && f->writable) {
int r; int r;
@ -378,11 +378,11 @@ JournalFile* journal_file_close(JournalFile *f) {
ordered_hashmap_free_free(f->chain_cache); ordered_hashmap_free_free(f->chain_cache);
#if defined(HAVE_XZ) || defined(HAVE_LZ4) #if HAVE_XZ || HAVE_LZ4
free(f->compress_buffer); free(f->compress_buffer);
#endif #endif
#ifdef HAVE_GCRYPT #if HAVE_GCRYPT
if (f->fss_file) if (f->fss_file)
munmap(f->fss_file, PAGE_ALIGN(f->fss_file_size)); munmap(f->fss_file, PAGE_ALIGN(f->fss_file_size));
else else
@ -1401,7 +1401,7 @@ int journal_file_find_data_object_with_hash(
goto next; goto next;
if (o->object.flags & OBJECT_COMPRESSION_MASK) { if (o->object.flags & OBJECT_COMPRESSION_MASK) {
#if defined(HAVE_XZ) || defined(HAVE_LZ4) #if HAVE_XZ || HAVE_LZ4
uint64_t l; uint64_t l;
size_t rsize = 0; size_t rsize = 0;
@ -1513,7 +1513,7 @@ static int journal_file_append_field(
if (r < 0) if (r < 0)
return r; return r;
#ifdef HAVE_GCRYPT #if HAVE_GCRYPT
r = journal_file_hmac_put_object(f, OBJECT_FIELD, o, p); r = journal_file_hmac_put_object(f, OBJECT_FIELD, o, p);
if (r < 0) if (r < 0)
return r; return r;
@ -1565,7 +1565,7 @@ static int journal_file_append_data(
o->data.hash = htole64(hash); 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) { if (JOURNAL_FILE_COMPRESS(f) && size >= COMPRESSION_SIZE_THRESHOLD) {
size_t rsize = 0; size_t rsize = 0;
@ -1590,7 +1590,7 @@ static int journal_file_append_data(
if (r < 0) if (r < 0)
return r; return r;
#ifdef HAVE_GCRYPT #if HAVE_GCRYPT
r = journal_file_hmac_put_object(f, OBJECT_DATA, o, p); r = journal_file_hmac_put_object(f, OBJECT_DATA, o, p);
if (r < 0) if (r < 0)
return r; return r;
@ -1704,7 +1704,7 @@ static int link_entry_into_array(JournalFile *f,
if (r < 0) if (r < 0)
return r; return r;
#ifdef HAVE_GCRYPT #if HAVE_GCRYPT
r = journal_file_hmac_put_object(f, OBJECT_ENTRY_ARRAY, o, q); r = journal_file_hmac_put_object(f, OBJECT_ENTRY_ARRAY, o, q);
if (r < 0) if (r < 0)
return r; return r;
@ -1854,7 +1854,7 @@ static int journal_file_append_entry_internal(
o->entry.xor_hash = htole64(xor_hash); o->entry.xor_hash = htole64(xor_hash);
o->entry.boot_id = f->header->boot_id; 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); r = journal_file_hmac_put_object(f, OBJECT_ENTRY, o, np);
if (r < 0) if (r < 0)
return r; return r;
@ -1990,7 +1990,7 @@ int journal_file_append_entry(JournalFile *f, const dual_timestamp *ts, const st
ts = &_ts; ts = &_ts;
} }
#ifdef HAVE_GCRYPT #if HAVE_GCRYPT
r = journal_file_maybe_append_tag(f, ts->realtime); r = journal_file_maybe_append_tag(f, ts->realtime);
if (r < 0) if (r < 0)
return r; return r;
@ -3259,12 +3259,12 @@ int journal_file_open(
f->flags = flags; f->flags = flags;
f->prot = prot_from_flags(flags); f->prot = prot_from_flags(flags);
f->writable = (flags & O_ACCMODE) != O_RDONLY; f->writable = (flags & O_ACCMODE) != O_RDONLY;
#if defined(HAVE_LZ4) #if HAVE_LZ4
f->compress_lz4 = compress; f->compress_lz4 = compress;
#elif defined(HAVE_XZ) #elif HAVE_XZ
f->compress_xz = compress; f->compress_xz = compress;
#endif #endif
#ifdef HAVE_GCRYPT #if HAVE_GCRYPT
f->seal = seal; f->seal = seal;
#endif #endif
@ -3335,7 +3335,7 @@ int journal_file_open(
fd_setcrtime(f->fd, 0); fd_setcrtime(f->fd, 0);
#ifdef HAVE_GCRYPT #if HAVE_GCRYPT
/* Try to load the FSPRG state, and if we can't, then /* Try to load the FSPRG state, and if we can't, then
* just don't do sealing */ * just don't do sealing */
if (f->seal) { if (f->seal) {
@ -3376,7 +3376,7 @@ int journal_file_open(
goto fail; goto fail;
} }
#ifdef HAVE_GCRYPT #if HAVE_GCRYPT
if (!newly_created && f->writable) { if (!newly_created && f->writable) {
r = journal_file_fss_load(f); r = journal_file_fss_load(f);
if (r < 0) if (r < 0)
@ -3396,7 +3396,7 @@ int journal_file_open(
goto fail; goto fail;
} }
#ifdef HAVE_GCRYPT #if HAVE_GCRYPT
r = journal_file_hmac_setup(f); r = journal_file_hmac_setup(f);
if (r < 0) if (r < 0)
goto fail; goto fail;
@ -3411,7 +3411,7 @@ int journal_file_open(
if (r < 0) if (r < 0)
goto fail; goto fail;
#ifdef HAVE_GCRYPT #if HAVE_GCRYPT
r = journal_file_append_first_tag(f); r = journal_file_append_first_tag(f);
if (r < 0) if (r < 0)
goto fail; goto fail;
@ -3622,7 +3622,7 @@ int journal_file_copy_entry(JournalFile *from, JournalFile *to, Object *o, uint6
return -E2BIG; return -E2BIG;
if (o->object.flags & OBJECT_COMPRESSION_MASK) { if (o->object.flags & OBJECT_COMPRESSION_MASK) {
#if defined(HAVE_XZ) || defined(HAVE_LZ4) #if HAVE_XZ || HAVE_LZ4
size_t rsize = 0; size_t rsize = 0;
r = decompress_blob(o->object.flags & OBJECT_COMPRESSION_MASK, r = decompress_blob(o->object.flags & OBJECT_COMPRESSION_MASK,

View File

@ -21,7 +21,7 @@
#include <inttypes.h> #include <inttypes.h>
#ifdef HAVE_GCRYPT #if HAVE_GCRYPT
#include <gcrypt.h> #include <gcrypt.h>
#endif #endif
@ -121,12 +121,12 @@ typedef struct JournalFile {
pthread_t offline_thread; pthread_t offline_thread;
volatile OfflineState offline_state; volatile OfflineState offline_state;
#if defined(HAVE_XZ) || defined(HAVE_LZ4) #if HAVE_XZ || HAVE_LZ4
void *compress_buffer; void *compress_buffer;
size_t compress_buffer_size; size_t compress_buffer_size;
#endif #endif
#ifdef HAVE_GCRYPT #if HAVE_GCRYPT
gcry_md_hd_t hmac; gcry_md_hd_t hmac;
bool hmac_running; bool hmac_running;

View File

@ -834,13 +834,13 @@ int journal_file_verify(
bool found_last = false; bool found_last = false;
const char *tmp_dir = NULL; const char *tmp_dir = NULL;
#ifdef HAVE_GCRYPT #if HAVE_GCRYPT
uint64_t last_tag = 0; uint64_t last_tag = 0;
#endif #endif
assert(f); assert(f);
if (key) { if (key) {
#ifdef HAVE_GCRYPT #if HAVE_GCRYPT
r = journal_file_parse_verification_key(f, key); r = journal_file_parse_verification_key(f, key);
if (r < 0) { if (r < 0) {
log_error("Failed to parse seed."); log_error("Failed to parse seed.");
@ -1103,7 +1103,7 @@ int journal_file_verify(
goto fail; goto fail;
} }
#ifdef HAVE_GCRYPT #if HAVE_GCRYPT
if (f->seal) { if (f->seal) {
uint64_t q, rt; uint64_t q, rt;

View File

@ -105,7 +105,7 @@ static char **arg_file = NULL;
static bool arg_file_stdin = false; static bool arg_file_stdin = false;
static int arg_priorities = 0xFF; static int arg_priorities = 0xFF;
static char *arg_verify_key = NULL; static char *arg_verify_key = NULL;
#ifdef HAVE_GCRYPT #if HAVE_GCRYPT
static usec_t arg_interval = DEFAULT_FSS_INTERVAL_USEC; static usec_t arg_interval = DEFAULT_FSS_INTERVAL_USEC;
static bool arg_force = false; static bool arg_force = false;
#endif #endif
@ -313,7 +313,7 @@ static void help(void) {
" -D --directory=PATH Show journal files from directory\n" " -D --directory=PATH Show journal files from directory\n"
" --file=PATH Show journal file\n" " --file=PATH Show journal file\n"
" --root=ROOT Operate on files below a root directory\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" " --interval=TIME Time interval for changing the FSS sealing key\n"
" --verify-key=KEY Specify FSS verification key\n" " --verify-key=KEY Specify FSS verification key\n"
" --force Override of the FSS key pair with --setup-keys\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" " --dump-catalog Show entries in the message catalog\n"
" --update-catalog Update the message catalog database\n" " --update-catalog Update the message catalog database\n"
" --new-id128 Generate a new 128-bit ID\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" " --setup-keys Generate a new FSS key pair\n"
#endif #endif
, program_invocation_short_name); , program_invocation_short_name);
@ -669,7 +669,7 @@ static int parse_argv(int argc, char *argv[]) {
arg_action = ACTION_VACUUM; arg_action = ACTION_VACUUM;
break; break;
#ifdef HAVE_GCRYPT #if HAVE_GCRYPT
case ARG_FORCE: case ARG_FORCE:
arg_force = true; arg_force = true;
break; break;
@ -1561,7 +1561,7 @@ static int add_syslog_identifier(sd_journal *j) {
} }
static int setup_keys(void) { static int setup_keys(void) {
#ifdef HAVE_GCRYPT #if HAVE_GCRYPT
size_t mpk_size, seed_size, state_size, i; size_t mpk_size, seed_size, state_size, i;
uint8_t *mpk, *seed, *state; uint8_t *mpk, *seed, *state;
int fd = -1, r; int fd = -1, r;
@ -1727,7 +1727,7 @@ static int setup_keys(void) {
} else } else
fprintf(stderr, "\nThe keys have been generated for host " SD_ID128_FORMAT_STR ".\n", SD_ID128_FORMAT_VAL(machine)); 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 this is not an UTF-8 system don't print any QR codes */
if (is_locale_utf8()) { if (is_locale_utf8()) {
fputs("\nTo transfer the verification key to your phone please scan the QR code below:\n\n", stderr); 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; int k;
usec_t first = 0, validated = 0, last = 0; usec_t first = 0, validated = 0, last = 0;
#ifdef HAVE_GCRYPT #if HAVE_GCRYPT
if (!arg_verify_key && JOURNAL_HEADER_SEALED(f->header)) 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); log_notice("Journal file %s has sealing enabled but verification key has not been passed using --verify-key=.", f->path);
#endif #endif

View File

@ -17,7 +17,7 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>. along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/ ***/
#ifdef HAVE_SELINUX #if HAVE_SELINUX
#include <selinux/selinux.h> #include <selinux/selinux.h>
#endif #endif
@ -227,7 +227,7 @@ static int client_context_read_label(
free_and_replace(c->label, l); free_and_replace(c->label, l);
c->label_size = label_size; c->label_size = label_size;
} }
#ifdef HAVE_SELINUX #if HAVE_SELINUX
else { else {
char *con; char *con;

View File

@ -521,7 +521,7 @@ int server_open_native_socket(Server*s) {
if (r < 0) if (r < 0)
return log_error_errno(errno, "SO_PASSCRED failed: %m"); return log_error_errno(errno, "SO_PASSCRED failed: %m");
#ifdef HAVE_SELINUX #if HAVE_SELINUX
if (mac_selinux_use()) { if (mac_selinux_use()) {
r = setsockopt(s->native_fd, SOL_SOCKET, SO_PASSSEC, &one, sizeof(one)); r = setsockopt(s->native_fd, SOL_SOCKET, SO_PASSSEC, &one, sizeof(one));
if (r < 0) if (r < 0)

View File

@ -17,7 +17,7 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>. along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/ ***/
#ifdef HAVE_SELINUX #if HAVE_SELINUX
#include <selinux/selinux.h> #include <selinux/selinux.h>
#endif #endif
#include <sys/ioctl.h> #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) { static void server_add_acls(JournalFile *f, uid_t uid) {
#ifdef HAVE_ACL #if HAVE_ACL
int r; int r;
#endif #endif
assert(f); assert(f);
#ifdef HAVE_ACL #if HAVE_ACL
if (uid <= SYSTEM_UID_MAX) if (uid <= SYSTEM_UID_MAX)
return; return;
@ -1868,7 +1868,7 @@ int server_init(Server *s) {
} }
void server_maybe_append_tags(Server *s) { void server_maybe_append_tags(Server *s) {
#ifdef HAVE_GCRYPT #if HAVE_GCRYPT
JournalFile *f; JournalFile *f;
Iterator i; Iterator i;
usec_t n; usec_t n;

View File

@ -20,7 +20,7 @@
#include <stddef.h> #include <stddef.h>
#include <unistd.h> #include <unistd.h>
#ifdef HAVE_SELINUX #if HAVE_SELINUX
#include <selinux/selinux.h> #include <selinux/selinux.h>
#endif #endif

View File

@ -414,7 +414,7 @@ int server_open_syslog_socket(Server *s) {
if (r < 0) if (r < 0)
return log_error_errno(errno, "SO_PASSCRED failed: %m"); return log_error_errno(errno, "SO_PASSCRED failed: %m");
#ifdef HAVE_SELINUX #if HAVE_SELINUX
if (mac_selinux_use()) { if (mac_selinux_use()) {
r = setsockopt(s->syslog_fd, SOL_SOCKET, SO_PASSSEC, &one, sizeof(one)); r = setsockopt(s->syslog_fd, SOL_SOCKET, SO_PASSSEC, &one, sizeof(one));
if (r < 0) if (r < 0)

View File

@ -91,7 +91,7 @@ int main(int argc, char *argv[]) {
t = server.oldest_file_usec + server.max_retention_usec - n; t = server.oldest_file_usec + server.max_retention_usec - n;
} }
#ifdef HAVE_GCRYPT #if HAVE_GCRYPT
if (server.system_journal) { if (server.system_journal) {
usec_t u; usec_t u;

View File

@ -20,7 +20,7 @@ journal_internal_sources = files('''
sd-journal.c sd-journal.c
'''.split()) '''.split())
if conf.get('HAVE_GCRYPT', false) if conf.get('HAVE_GCRYPT') == 1
journal_internal_sources += files(''' journal_internal_sources += files('''
journal-authenticate.c journal-authenticate.c
journal-authenticate.h journal-authenticate.h
@ -36,7 +36,7 @@ endif
audit_type_includes = [config_h, audit_type_includes = [config_h,
missing_h, missing_h,
'linux/audit.h'] 'linux/audit.h']
if conf.get('HAVE_AUDIT', false) if conf.get('HAVE_AUDIT') == 1
audit_type_includes += 'libaudit.h' audit_type_includes += 'libaudit.h'
endif endif
@ -97,7 +97,7 @@ systemd_cat_sources = files('cat.c')
journalctl_sources = files('journalctl.c') journalctl_sources = files('journalctl.c')
if conf.get('HAVE_QRENCODE', false) if conf.get('HAVE_QRENCODE') == 1
journalctl_sources += files('journal-qrcode.c', journalctl_sources += files('journal-qrcode.c',
'journal-qrcode.h') 'journal-qrcode.h')
endif endif

View File

@ -84,7 +84,7 @@ struct MMapCache {
#define WINDOWS_MIN 64 #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. */ /* Tiny windows increase mmap activity and the chance of exposing unsafe use. */
# define WINDOW_SIZE (page_size()) # define WINDOW_SIZE (page_size())
#else #else
@ -225,7 +225,7 @@ static void context_detach_window(Context *c) {
if (!w->contexts && !w->keep_always) { if (!w->contexts && !w->keep_always) {
/* Not used anymore? */ /* Not used anymore? */
#ifdef ENABLE_DEBUG_MMAP_CACHE #if ENABLE_DEBUG_MMAP_CACHE
/* Unmap unused windows immediately to expose use-after-unmap /* Unmap unused windows immediately to expose use-after-unmap
* by SIGSEGV. */ * by SIGSEGV. */
window_free(w); window_free(w);

View File

@ -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; compression = o->object.flags & OBJECT_COMPRESSION_MASK;
if (compression) { if (compression) {
#if defined(HAVE_XZ) || defined(HAVE_LZ4) #if HAVE_XZ || HAVE_LZ4
r = decompress_startswith(compression, r = decompress_startswith(compression,
o->data.payload, l, o->data.payload, l,
&f->compress_buffer, &f->compress_buffer_size, &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; compression = o->object.flags & OBJECT_COMPRESSION_MASK;
if (compression) { if (compression) {
#if defined(HAVE_XZ) || defined(HAVE_LZ4) #if HAVE_XZ || HAVE_LZ4
size_t rsize; size_t rsize;
int r; int r;

View File

@ -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, 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); 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 usec_t arg_duration;
static size_t arg_start; static size_t arg_start;
@ -157,7 +157,7 @@ static void test_compress_decompress(const char* label, const char* type,
#endif #endif
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
#if defined(HAVE_XZ) || defined(HAVE_LZ4) #if HAVE_XZ || HAVE_LZ4
const char *i; const char *i;
int r; int r;
@ -183,10 +183,10 @@ int main(int argc, char *argv[]) {
arg_start = getpid_cached(); arg_start = getpid_cached();
NULSTR_FOREACH(i, "zeros\0simple\0random\0") { NULSTR_FOREACH(i, "zeros\0simple\0random\0") {
#ifdef HAVE_XZ #if HAVE_XZ
test_compress_decompress("XZ", i, compress_blob_xz, decompress_blob_xz); test_compress_decompress("XZ", i, compress_blob_xz, decompress_blob_xz);
#endif #endif
#ifdef HAVE_LZ4 #if HAVE_LZ4
test_compress_decompress("LZ4", i, compress_blob_lz4, decompress_blob_lz4); test_compress_decompress("LZ4", i, compress_blob_lz4, decompress_blob_lz4);
#endif #endif
} }

View File

@ -17,7 +17,7 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>. along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/ ***/
#ifdef HAVE_LZ4 #if HAVE_LZ4
#include <lz4.h> #include <lz4.h>
#endif #endif
@ -29,13 +29,13 @@
#include "random-util.h" #include "random-util.h"
#include "util.h" #include "util.h"
#ifdef HAVE_XZ #if HAVE_XZ
# define XZ_OK 0 # define XZ_OK 0
#else #else
# define XZ_OK -EPROTONOSUPPORT # define XZ_OK -EPROTONOSUPPORT
#endif #endif
#ifdef HAVE_LZ4 #if HAVE_LZ4
# define LZ4_OK 0 # define LZ4_OK 0
#else #else
# define LZ4_OK -EPROTONOSUPPORT # 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 (compress_stream_t)(int fdf, int fdt, uint64_t max_bytes);
typedef int (decompress_stream_t)(int fdf, int fdt, uint64_t max_size); 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, static void test_compress_decompress(int compression,
compress_blob_t compress, compress_blob_t compress,
decompress_blob_t decompress, decompress_blob_t decompress,
@ -206,7 +206,7 @@ static void test_compress_stream(int compression,
} }
#endif #endif
#ifdef HAVE_LZ4 #if HAVE_LZ4
static void test_lz4_decompress_partial(void) { static void test_lz4_decompress_partial(void) {
char buf[20000]; char buf[20000];
size_t buf_size = sizeof(buf), compressed; size_t buf_size = sizeof(buf), compressed;
@ -249,7 +249,7 @@ static void test_lz4_decompress_partial(void) {
#endif #endif
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
#if defined(HAVE_XZ) || defined(HAVE_LZ4) #if HAVE_XZ || HAVE_LZ4
const char text[] = const char text[] =
"text\0foofoofoofoo AAAA aaaaaaaaa ghost busters barbarbar FFF" "text\0foofoofoofoo AAAA aaaaaaaaa ghost busters barbarbar FFF"
"foofoofoofoo 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); 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, test_compress_decompress(OBJECT_COMPRESSED_XZ, compress_blob_xz, decompress_blob_xz,
text, sizeof(text), false); text, sizeof(text), false);
test_compress_decompress(OBJECT_COMPRESSED_XZ, compress_blob_xz, decompress_blob_xz, 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 */"); log_info("/* XZ test skipped */");
#endif #endif
#ifdef HAVE_LZ4 #if HAVE_LZ4
test_compress_decompress(OBJECT_COMPRESSED_LZ4, compress_blob_lz4, decompress_blob_lz4, test_compress_decompress(OBJECT_COMPRESSED_LZ4, compress_blob_lz4, decompress_blob_lz4,
text, sizeof(text), false); text, sizeof(text), false);
test_compress_decompress(OBJECT_COMPRESSED_LZ4, compress_blob_lz4, decompress_blob_lz4, test_compress_decompress(OBJECT_COMPRESSED_LZ4, compress_blob_lz4, decompress_blob_lz4,

View File

@ -58,7 +58,7 @@ static void test_non_empty(void) {
iovec.iov_len = strlen(test); iovec.iov_len = strlen(test);
assert_se(journal_file_append_entry(f, &ts, &iovec, 1, NULL, NULL, NULL) == 0); 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); journal_file_append_tag(f);
#endif #endif
journal_file_dump(f); journal_file_dump(f);

View File

@ -17,7 +17,7 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>. 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> #include <valgrind/memcheck.h>
#endif #endif

View File

@ -17,7 +17,7 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>. 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> #include <valgrind/memcheck.h>
#endif #endif

View File

@ -17,7 +17,7 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>. along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/ ***/
#ifdef HAVE_GLIB #if HAVE_GLIB
#include <glib.h> #include <glib.h>
#endif #endif
@ -155,7 +155,7 @@ static void test_marshal(void) {
assert_se(bus_message_seal(m, 4711, 0) >= 0); assert_se(bus_message_seal(m, 4711, 0) >= 0);
#ifdef HAVE_GLIB #if HAVE_GLIB
{ {
GVariant *v; GVariant *v;
char *t; char *t;
@ -184,7 +184,7 @@ static void test_marshal(void) {
assert_se(bus_message_get_blob(m, &blob, &sz) >= 0); assert_se(bus_message_get_blob(m, &blob, &sz) >= 0);
#ifdef HAVE_GLIB #if HAVE_GLIB
{ {
GVariant *v; GVariant *v;
char *t; char *t;

View File

@ -20,11 +20,11 @@
#include <math.h> #include <math.h>
#include <stdlib.h> #include <stdlib.h>
#ifdef HAVE_GLIB #if HAVE_GLIB
#include <gio/gio.h> #include <gio/gio.h>
#endif #endif
#ifdef HAVE_DBUS #if HAVE_DBUS
#include <dbus/dbus.h> #include <dbus/dbus.h>
#endif #endif
@ -215,7 +215,7 @@ int main(int argc, char *argv[]) {
log_info("message size = %zu, contents =\n%s", sz, h); log_info("message size = %zu, contents =\n%s", sz, h);
free(h); free(h);
#ifdef HAVE_GLIB #if HAVE_GLIB
{ {
GDBusMessage *g; GDBusMessage *g;
char *p; char *p;
@ -232,7 +232,7 @@ int main(int argc, char *argv[]) {
} }
#endif #endif
#ifdef HAVE_DBUS #if HAVE_DBUS
{ {
DBusMessage *w; DBusMessage *w;
DBusError error; DBusError error;

View File

@ -317,7 +317,7 @@ static const char hwdb_bin_paths[] =
"/etc/systemd/hwdb/hwdb.bin\0" "/etc/systemd/hwdb/hwdb.bin\0"
"/etc/udev/hwdb.bin\0" "/etc/udev/hwdb.bin\0"
"/usr/lib/systemd/hwdb/hwdb.bin\0" "/usr/lib/systemd/hwdb/hwdb.bin\0"
#ifdef HAVE_SPLIT_USR #if HAVE_SPLIT_USR
"/lib/systemd/hwdb/hwdb.bin\0" "/lib/systemd/hwdb/hwdb.bin\0"
#endif #endif
UDEVLIBEXECDIR "/hwdb.bin\0"; UDEVLIBEXECDIR "/hwdb.bin\0";

View File

@ -493,7 +493,7 @@ static int get_search(uint64_t type, char ***list) {
"/usr/local/bin", "/usr/local/bin",
"/usr/sbin", "/usr/sbin",
"/usr/bin", "/usr/bin",
#ifdef HAVE_SPLIT_USR #if HAVE_SPLIT_USR
"/sbin", "/sbin",
"/bin", "/bin",
#endif #endif
@ -507,7 +507,7 @@ static int get_search(uint64_t type, char ***list) {
false, false,
"/usr/local/lib", "/usr/local/lib",
"/usr/lib", "/usr/lib",
#ifdef HAVE_SPLIT_USR #if HAVE_SPLIT_USR
"/lib", "/lib",
#endif #endif
NULL); NULL);
@ -519,7 +519,7 @@ static int get_search(uint64_t type, char ***list) {
"LD_LIBRARY_PATH", "LD_LIBRARY_PATH",
true, true,
LIBDIR, LIBDIR,
#ifdef HAVE_SPLIT_USR #if HAVE_SPLIT_USR
ROOTLIBDIR, ROOTLIBDIR,
#endif #endif
NULL); NULL);

View File

@ -22,7 +22,7 @@
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
#ifdef HAVE_XKBCOMMON #if HAVE_XKBCOMMON
#include <xkbcommon/xkbcommon.h> #include <xkbcommon/xkbcommon.h>
#include <dlfcn.h> #include <dlfcn.h>
#endif #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); return sd_bus_reply_method_return(m, NULL);
} }
#ifdef HAVE_XKBCOMMON #if HAVE_XKBCOMMON
_printf_(3, 0) _printf_(3, 0)
static void log_xkb(struct xkb_context *ctx, enum xkb_log_level lvl, const char *format, va_list args) { static void log_xkb(struct xkb_context *ctx, enum xkb_log_level lvl, const char *format, va_list args) {

View File

@ -6,7 +6,7 @@ systemd_localed_sources = files('''
localectl_sources = files('localectl.c') localectl_sources = files('localectl.c')
if conf.get('ENABLE_LOCALED', false) if conf.get('ENABLE_LOCALED') == 1
install_data('org.freedesktop.locale1.conf', install_data('org.freedesktop.locale1.conf',
install_dir : dbuspolicydir) install_dir : dbuspolicydir)
install_data('org.freedesktop.locale1.service', install_data('org.freedesktop.locale1.service',
@ -27,7 +27,7 @@ endif
kbd_model_map = join_paths(meson.current_source_dir(), 'kbd-model-map') kbd_model_map = join_paths(meson.current_source_dir(), 'kbd-model-map')
language_fallback_map = join_paths(meson.current_source_dir(), 'language-fallback-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', install_data('kbd-model-map',
'language-fallback-map', 'language-fallback-map',
install_dir : pkgdatadir) install_dir : pkgdatadir)

View File

@ -24,7 +24,7 @@
#include "libudev.h" #include "libudev.h"
#ifdef HAVE_ACL #if HAVE_ACL
int devnode_acl(const char *path, int devnode_acl(const char *path,
bool flush, bool flush,

View File

@ -39,7 +39,7 @@ liblogind_core_sources = files('''
'''.split()) '''.split())
logind_acl_c = files('logind-acl.c') 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 liblogind_core_sources += logind_acl_c
endif endif
@ -55,7 +55,7 @@ loginctl_sources = files('''
sysfs-show.c sysfs-show.c
'''.split()) '''.split())
if conf.get('ENABLE_LOGIND', false) if conf.get('ENABLE_LOGIND') == 1
logind_conf = configure_file( logind_conf = configure_file(
input : 'logind.conf.in', input : 'logind.conf.in',
output : 'logind.conf', output : 'logind.conf',

View File

@ -21,7 +21,7 @@ libmachine_core = static_library(
include_directories : includes, include_directories : includes,
dependencies : [threads]) dependencies : [threads])
if conf.get('ENABLE_MACHINED', false) if conf.get('ENABLE_MACHINED') == 1
install_data('org.freedesktop.machine1.conf', install_data('org.freedesktop.machine1.conf',
install_dir : dbuspolicydir) install_dir : dbuspolicydir)
install_data('org.freedesktop.machine1.service', install_data('org.freedesktop.machine1.service',

View File

@ -81,7 +81,7 @@ networkctl_sources = files('networkctl.c')
network_include_dir = include_directories('.') 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 = custom_target(
'networkd-gperf.c', 'networkd-gperf.c',
input : 'networkd-gperf.gperf', input : 'networkd-gperf.gperf',

View File

@ -48,7 +48,7 @@ const char* const network_dirs[] = {
"/etc/systemd/network", "/etc/systemd/network",
"/run/systemd/network", "/run/systemd/network",
"/usr/lib/systemd/network", "/usr/lib/systemd/network",
#ifdef HAVE_SPLIT_USR #if HAVE_SPLIT_USR
"/lib/systemd/network", "/lib/systemd/network",
#endif #endif
NULL}; NULL};

View File

@ -374,7 +374,7 @@ static int tmpfs_patch_options(
options = buf; options = buf;
} }
#ifdef HAVE_SELINUX #if HAVE_SELINUX
if (selinux_apifs_context) { if (selinux_apifs_context) {
char *t; 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", "tmpfs", "mode=755", MS_NOSUID|MS_STRICTATIME, MOUNT_FATAL },
{ "tmpfs", "/dev/shm", "tmpfs", "mode=1777", MS_NOSUID|MS_NODEV|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 }, { "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 */ { "/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 */ { 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 #endif

View File

@ -19,7 +19,7 @@
#include <fcntl.h> #include <fcntl.h>
#include <linux/magic.h> #include <linux/magic.h>
#ifdef HAVE_ACL #if HAVE_ACL
#include <sys/acl.h> #include <sys/acl.h>
#endif #endif
#include <sys/stat.h> #include <sys/stat.h>
@ -37,7 +37,7 @@
#include "strv.h" #include "strv.h"
#include "user-util.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) { 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]; char procfs_path[strlen("/proc/self/fd/") + DECIMAL_STR_MAX(int) + 1];

View File

@ -22,20 +22,20 @@
#include <sys/capability.h> #include <sys/capability.h>
#include <sys/types.h> #include <sys/types.h>
#ifdef HAVE_SECCOMP #if HAVE_SECCOMP
#include <seccomp.h> #include <seccomp.h>
#endif #endif
#include "alloc-util.h" #include "alloc-util.h"
#include "log.h" #include "log.h"
#include "nspawn-seccomp.h" #include "nspawn-seccomp.h"
#ifdef HAVE_SECCOMP #if HAVE_SECCOMP
#include "seccomp-util.h" #include "seccomp-util.h"
#endif #endif
#include "string-util.h" #include "string-util.h"
#include "strv.h" #include "strv.h"
#ifdef HAVE_SECCOMP #if HAVE_SECCOMP
static int seccomp_add_default_syscall_filter( static int seccomp_add_default_syscall_filter(
scmp_filter_ctx ctx, scmp_filter_ctx ctx,

View File

@ -17,7 +17,7 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>. along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/ ***/
#ifdef HAVE_BLKID #if HAVE_BLKID
#include <blkid.h> #include <blkid.h>
#endif #endif
#include <errno.h> #include <errno.h>
@ -26,7 +26,7 @@
#include <linux/loop.h> #include <linux/loop.h>
#include <pwd.h> #include <pwd.h>
#include <sched.h> #include <sched.h>
#ifdef HAVE_SELINUX #if HAVE_SELINUX
#include <selinux/selinux.h> #include <selinux/selinux.h>
#endif #endif
#include <signal.h> #include <signal.h>
@ -1234,7 +1234,7 @@ static int verify_arguments(void) {
return -EINVAL; return -EINVAL;
} }
#ifndef HAVE_LIBIPTC #if ! HAVE_LIBIPTC
if (arg_expose_ports) { if (arg_expose_ports) {
log_error("--port= is not supported, compiled without libiptc support."); log_error("--port= is not supported, compiled without libiptc support.");
return -EOPNOTSUPP; return -EOPNOTSUPP;
@ -1547,7 +1547,7 @@ static int setup_pts(const char *dest) {
const char *p; const char *p;
int r; int r;
#ifdef HAVE_SELINUX #if HAVE_SELINUX
if (arg_selinux_apifs_context) if (arg_selinux_apifs_context)
(void) asprintf(&options, (void) asprintf(&options,
"newinstance,ptmxmode=0666,mode=620,gid=" GID_FMT ",context=\"%s\"", "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"); return log_error_errno(r, "personality() failed: %m");
} }
#ifdef HAVE_SELINUX #if HAVE_SELINUX
if (arg_selinux_context) if (arg_selinux_context)
if (setexeccon(arg_selinux_context) < 0) if (setexeccon(arg_selinux_context) < 0)
return log_error_errno(errno, "setexeccon(\"%s\") failed: %m", arg_selinux_context); return log_error_errno(errno, "setexeccon(\"%s\") failed: %m", arg_selinux_context);

View File

@ -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); log_warning("Invalid quotacheck.mode= parameter '%s'. Ignoring.", value);
} }
#ifdef HAVE_SYSV_COMPAT #if HAVE_SYSV_COMPAT
else if (streq(key, "forcequotacheck") && !value) { else if (streq(key, "forcequotacheck") && !value) {
log_warning("Please use 'quotacheck.mode=force' rather than 'forcequotacheck' on the kernel command line."); log_warning("Please use 'quotacheck.mode=force' rather than 'forcequotacheck' on the kernel command line.");
arg_force = true; 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) { static void test_files(void) {
#ifdef HAVE_SYSV_COMPAT #if HAVE_SYSV_COMPAT
if (access("/forcequotacheck", F_OK) >= 0) { 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."); log_error("Please pass 'quotacheck.mode=force' on the kernel command line rather than creating /forcequotacheck on the root file system.");
arg_force = true; arg_force = true;

View File

@ -123,7 +123,7 @@ systemd_resolve_sources = (basic_dns_sources +
systemd_resolve_only_sources + systemd_resolve_only_sources +
dns_type_headers) dns_type_headers)
if conf.get('ENABLE_RESOLVED', false) if conf.get('ENABLE_RESOLVED') == 1
install_data('org.freedesktop.resolve1.conf', install_data('org.freedesktop.resolve1.conf',
install_dir : dbuspolicydir) install_dir : dbuspolicydir)
install_data('org.freedesktop.resolve1.service', install_data('org.freedesktop.resolve1.service',

View File

@ -246,7 +246,7 @@ int manager_parse_config_file(Manager *m) {
return r; return r;
} }
#ifndef HAVE_GCRYPT #if ! HAVE_GCRYPT
if (m->dnssec_mode != DNSSEC_NO) { 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."); 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; m->dnssec_mode = DNSSEC_NO;

View File

@ -17,7 +17,7 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>. along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/ ***/
#ifdef HAVE_GCRYPT #if HAVE_GCRYPT
#include <gcrypt.h> #include <gcrypt.h>
#endif #endif
@ -125,7 +125,7 @@ int dnssec_canonicalize(const char *n, char *buffer, size_t buffer_max) {
return (int) c; return (int) c;
} }
#ifdef HAVE_GCRYPT #if HAVE_GCRYPT
static int rr_compare(const void *a, const void *b) { static int rr_compare(const void *a, const void *b) {
DnsResourceRecord **x = (DnsResourceRecord**) a, **y = (DnsResourceRecord**) b; DnsResourceRecord **x = (DnsResourceRecord**) a, **y = (DnsResourceRecord**) b;

View File

@ -313,7 +313,7 @@ void link_set_dnssec_mode(Link *l, DnssecMode mode) {
assert(l); assert(l);
#ifndef HAVE_GCRYPT #if ! HAVE_GCRYPT
if (IN_SET(mode, DNSSEC_YES, DNSSEC_ALLOW_DOWNGRADE)) 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."); 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; return;

View File

@ -21,7 +21,7 @@
#include <poll.h> #include <poll.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#ifdef HAVE_LIBIDN2 #if HAVE_LIBIDN2
#include <idn2.h> #include <idn2.h>
#endif #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) { static int determine_hostname(char **full_hostname, char **llmnr_hostname, char **mdns_hostname) {
_cleanup_free_ char *h = NULL, *n = NULL; _cleanup_free_ char *h = NULL, *n = NULL;
#if defined(HAVE_LIBIDN2) #if HAVE_LIBIDN2
_cleanup_free_ char *utf8 = NULL; _cleanup_free_ char *utf8 = NULL;
#elif defined(HAVE_LIBIDN) #elif HAVE_LIBIDN
int k; int k;
#endif #endif
char label[DNS_LABEL_MAX]; char label[DNS_LABEL_MAX];
@ -356,7 +356,7 @@ static int determine_hostname(char **full_hostname, char **llmnr_hostname, char
return -EINVAL; return -EINVAL;
} }
#if defined(HAVE_LIBIDN2) #if HAVE_LIBIDN2
r = idn2_to_unicode_8z8z(label, &utf8, 0); r = idn2_to_unicode_8z8z(label, &utf8, 0);
if (r != IDN2_OK) if (r != IDN2_OK)
return log_error("Failed to undo IDNA: %s", idn2_strerror(r)); 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); r = strlen(utf8);
decoded = utf8; decoded = utf8;
#elif defined(HAVE_LIBIDN) #elif HAVE_LIBIDN
k = dns_label_undo_idna(label, r, label, sizeof label); k = dns_label_undo_idna(label, r, label, sizeof label);
if (k < 0) if (k < 0)
return log_error_errno(k, "Failed to undo IDNA: %m"); return log_error_errno(k, "Failed to undo IDNA: %m");

View File

@ -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_INET, NULL);
test_hostname_lookup(bus, "poettering.de", AF_INET6, 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 */ /* Unsigned A with IDNA conversion necessary */
test_hostname_lookup(bus, "pöttering.de", AF_UNSPEC, NULL); test_hostname_lookup(bus, "pöttering.de", AF_UNSPEC, NULL);
test_hostname_lookup(bus, "pöttering.de", AF_INET, NULL); test_hostname_lookup(bus, "pöttering.de", AF_INET, NULL);

View File

@ -47,7 +47,7 @@ static void test_dnssec_canonicalize(void) {
test_dnssec_canonicalize_one("FOO..bar.", NULL, -EINVAL); test_dnssec_canonicalize_one("FOO..bar.", NULL, -EINVAL);
} }
#ifdef HAVE_GCRYPT #if HAVE_GCRYPT
static void test_dnssec_verify_dns_key(void) { static void test_dnssec_verify_dns_key(void) {
@ -332,7 +332,7 @@ int main(int argc, char*argv[]) {
test_dnssec_canonicalize(); test_dnssec_canonicalize();
#ifdef HAVE_GCRYPT #if HAVE_GCRYPT
test_dnssec_verify_dns_key(); test_dnssec_verify_dns_key();
test_dnssec_verify_rrset(); test_dnssec_verify_rrset();
test_dnssec_verify_rrset2(); test_dnssec_verify_rrset2();

Some files were not shown because too many files have changed in this diff Show More