mirror of
https://github.com/systemd/systemd.git
synced 2024-12-22 17:35:35 +03:00
meson: Convert options to meson features (find_library fallback)
This uses a two-step approach to make sure we can fall back to find_library(), while also skipping the detection if the features are explicitly disabled.
This commit is contained in:
parent
9ee80846f8
commit
a0c9ac9ae4
88
meson.build
88
meson.build
@ -1178,18 +1178,13 @@ if have
|
|||||||
conf.set_quoted('SMACK_DEFAULT_PROCESS_LABEL', get_option('smack-default-process-label'))
|
conf.set_quoted('SMACK_DEFAULT_PROCESS_LABEL', get_option('smack-default-process-label'))
|
||||||
endif
|
endif
|
||||||
|
|
||||||
want_polkit = get_option('polkit')
|
feature = get_option('polkit')
|
||||||
install_polkit = false
|
libpolkit = dependency('polkit-gobject-1',
|
||||||
install_polkit_pkla = false
|
required : feature.disabled() ? feature : false)
|
||||||
if want_polkit != 'false' and not skip_deps
|
install_polkit = feature.allowed()
|
||||||
install_polkit = true
|
install_polkit_pkla = libpolkit.found() and libpolkit.version().version_compare('< 0.106')
|
||||||
|
if install_polkit_pkla
|
||||||
libpolkit = dependency('polkit-gobject-1',
|
message('Old polkit detected, will install pkla files')
|
||||||
required : false)
|
|
||||||
if libpolkit.found() and libpolkit.version().version_compare('< 0.106')
|
|
||||||
message('Old polkit detected, will install pkla files')
|
|
||||||
install_polkit_pkla = true
|
|
||||||
endif
|
|
||||||
endif
|
endif
|
||||||
conf.set10('ENABLE_POLKIT', install_polkit)
|
conf.set10('ENABLE_POLKIT', install_polkit)
|
||||||
|
|
||||||
@ -1217,24 +1212,19 @@ libxenctrl = dependency('xencontrol',
|
|||||||
required : get_option('xenctrl'))
|
required : get_option('xenctrl'))
|
||||||
conf.set10('HAVE_XENCTRL', libxenctrl.found())
|
conf.set10('HAVE_XENCTRL', libxenctrl.found())
|
||||||
|
|
||||||
want_pam = get_option('pam')
|
feature = get_option('pam')
|
||||||
if want_pam != 'false' and not skip_deps
|
libpam = dependency('pam',
|
||||||
libpam = dependency('pam', required : false)
|
required : feature.disabled() ? feature : false)
|
||||||
if not libpam.found()
|
if not libpam.found()
|
||||||
# Debian older than bookworm and Ubuntu older than 22.10 do not provide the .pc file.
|
# Debian older than bookworm and Ubuntu older than 22.10 do not provide the .pc file.
|
||||||
libpam = cc.find_library('pam', required : want_pam == 'true')
|
libpam = cc.find_library('pam', required : feature)
|
||||||
endif
|
|
||||||
libpam_misc = dependency('pam_misc', required : false)
|
|
||||||
if not libpam_misc.found()
|
|
||||||
libpam_misc = cc.find_library('pam_misc', required : want_pam == 'true')
|
|
||||||
endif
|
|
||||||
have = libpam.found() and libpam_misc.found()
|
|
||||||
else
|
|
||||||
have = false
|
|
||||||
libpam = []
|
|
||||||
libpam_misc = []
|
|
||||||
endif
|
endif
|
||||||
conf.set10('HAVE_PAM', have)
|
libpam_misc = dependency('pam_misc',
|
||||||
|
required : feature.disabled() ? feature : false)
|
||||||
|
if not libpam_misc.found()
|
||||||
|
libpam_misc = cc.find_library('pam_misc', required : feature)
|
||||||
|
endif
|
||||||
|
conf.set10('HAVE_PAM', libpam.found() and libpam_misc.found())
|
||||||
|
|
||||||
libmicrohttpd = dependency('libmicrohttpd',
|
libmicrohttpd = dependency('libmicrohttpd',
|
||||||
version : '>= 0.9.33',
|
version : '>= 0.9.33',
|
||||||
@ -1326,18 +1316,17 @@ libqrencode = dependency('libqrencode',
|
|||||||
required : get_option('qrencode'))
|
required : get_option('qrencode'))
|
||||||
conf.set10('HAVE_QRENCODE', libqrencode.found())
|
conf.set10('HAVE_QRENCODE', libqrencode.found())
|
||||||
|
|
||||||
want_gcrypt = get_option('gcrypt')
|
feature = get_option('gcrypt')
|
||||||
if want_gcrypt != 'false' and not skip_deps
|
libgcrypt = dependency('libgcrypt',
|
||||||
libgcrypt = dependency('libgcrypt', required : want_gcrypt == 'true')
|
required : feature)
|
||||||
libgpg_error = dependency('gpg-error', required : false)
|
libgpg_error = dependency('gpg-error',
|
||||||
if not libgpg_error.found()
|
required : feature.disabled() ? feature : false)
|
||||||
# CentOS 8 does not provide the .pc file.
|
if not libgpg_error.found()
|
||||||
libgpg_error = cc.find_library('gpg-error', required : want_gcrypt == 'true')
|
# CentOS 8 does not provide the .pc file.
|
||||||
endif
|
libgpg_error = cc.find_library('gpg-error', required : feature)
|
||||||
have = libgcrypt.found() and libgpg_error.found()
|
|
||||||
else
|
|
||||||
have = false
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
have = libgcrypt.found() and libgpg_error.found()
|
||||||
if not have
|
if not have
|
||||||
# link to neither of the libs if one is not found
|
# link to neither of the libs if one is not found
|
||||||
libgcrypt = []
|
libgcrypt = []
|
||||||
@ -1395,19 +1384,14 @@ libz = dependency('zlib',
|
|||||||
required : get_option('zlib'))
|
required : get_option('zlib'))
|
||||||
conf.set10('HAVE_ZLIB', libz.found())
|
conf.set10('HAVE_ZLIB', libz.found())
|
||||||
|
|
||||||
want_bzip2 = get_option('bzip2')
|
feature = get_option('bzip2')
|
||||||
if want_bzip2 != 'false' and not skip_deps
|
libbzip2 = dependency('bzip2',
|
||||||
libbzip2 = dependency('bzip2', required : false)
|
required : feature.disabled() ? feature : false)
|
||||||
if not libbzip2.found()
|
if not libbzip2.found()
|
||||||
# Debian and Ubuntu do not provide the .pc file.
|
# Debian and Ubuntu do not provide the .pc file.
|
||||||
libbzip2 = cc.find_library('bz2', required : want_bzip2 == 'true')
|
libbzip2 = cc.find_library('bz2', required : feature)
|
||||||
endif
|
|
||||||
have = libbzip2.found()
|
|
||||||
else
|
|
||||||
have = false
|
|
||||||
libbzip2 = []
|
|
||||||
endif
|
endif
|
||||||
conf.set10('HAVE_BZIP2', have)
|
conf.set10('HAVE_BZIP2', libbzip2.found())
|
||||||
|
|
||||||
libxz = dependency('liblzma',
|
libxz = dependency('liblzma',
|
||||||
required : get_option('xz'))
|
required : get_option('xz'))
|
||||||
|
@ -362,7 +362,7 @@ option('smack-run-label', type : 'string',
|
|||||||
description : 'run systemd --system itself with a specific SMACK label')
|
description : 'run systemd --system itself with a specific SMACK label')
|
||||||
option('smack-default-process-label', type : 'string',
|
option('smack-default-process-label', type : 'string',
|
||||||
description : 'default SMACK label for executed processes')
|
description : 'default SMACK label for executed processes')
|
||||||
option('polkit', type : 'combo', choices : ['auto', 'true', 'false'],
|
option('polkit', type : 'feature', deprecated : { 'true' : 'enabled', 'false' : 'disabled' },
|
||||||
description : 'polkit support')
|
description : 'polkit support')
|
||||||
option('ima', type : 'boolean',
|
option('ima', type : 'boolean',
|
||||||
description : 'IMA support')
|
description : 'IMA support')
|
||||||
@ -379,7 +379,7 @@ option('kmod', type : 'feature', deprecated : { 'true' : 'enabled', 'false' : 'd
|
|||||||
description : 'support for loadable modules')
|
description : 'support for loadable modules')
|
||||||
option('xenctrl', type : 'feature', deprecated : { 'true' : 'enabled', 'false' : 'disabled' },
|
option('xenctrl', type : 'feature', deprecated : { 'true' : 'enabled', 'false' : 'disabled' },
|
||||||
description : 'support for Xen kexec')
|
description : 'support for Xen kexec')
|
||||||
option('pam', type : 'combo', choices : ['auto', 'true', 'false'],
|
option('pam', type : 'feature', deprecated : { 'true' : 'enabled', 'false' : 'disabled' },
|
||||||
description : 'PAM support')
|
description : 'PAM support')
|
||||||
option('passwdqc', type : 'combo', choices : ['auto', 'true', 'false'],
|
option('passwdqc', type : 'combo', choices : ['auto', 'true', 'false'],
|
||||||
description : 'libpasswdqc support')
|
description : 'libpasswdqc support')
|
||||||
@ -403,7 +403,7 @@ option('libiptc', type : 'feature', deprecated : { 'true' : 'enabled', 'false' :
|
|||||||
description : 'libiptc support')
|
description : 'libiptc support')
|
||||||
option('qrencode', type : 'feature', deprecated : { 'true' : 'enabled', 'false' : 'disabled' },
|
option('qrencode', type : 'feature', deprecated : { 'true' : 'enabled', 'false' : 'disabled' },
|
||||||
description : 'libqrencode support')
|
description : 'libqrencode support')
|
||||||
option('gcrypt', type : 'combo', choices : ['auto', 'true', 'false'],
|
option('gcrypt', type : 'feature', deprecated : { 'true' : 'enabled', 'false' : 'disabled' },
|
||||||
description : 'gcrypt support')
|
description : 'gcrypt support')
|
||||||
option('gnutls', type : 'feature', deprecated : { 'true' : 'enabled', 'false' : 'disabled' },
|
option('gnutls', type : 'feature', deprecated : { 'true' : 'enabled', 'false' : 'disabled' },
|
||||||
description : 'gnutls support')
|
description : 'gnutls support')
|
||||||
@ -421,7 +421,7 @@ option('elfutils', type : 'feature', deprecated : { 'true' : 'enabled', 'false'
|
|||||||
description : 'elfutils support')
|
description : 'elfutils support')
|
||||||
option('zlib', type : 'feature', deprecated : { 'true' : 'enabled', 'false' : 'disabled' },
|
option('zlib', type : 'feature', deprecated : { 'true' : 'enabled', 'false' : 'disabled' },
|
||||||
description : 'zlib compression support')
|
description : 'zlib compression support')
|
||||||
option('bzip2', type : 'combo', choices : ['auto', 'true', 'false'],
|
option('bzip2', type : 'feature', deprecated : { 'true' : 'enabled', 'false' : 'disabled' },
|
||||||
description : 'bzip2 compression support')
|
description : 'bzip2 compression support')
|
||||||
option('xz', type : 'feature', deprecated : { 'true' : 'enabled', 'false' : 'disabled' },
|
option('xz', type : 'feature', deprecated : { 'true' : 'enabled', 'false' : 'disabled' },
|
||||||
description : 'xz compression support')
|
description : 'xz compression support')
|
||||||
|
@ -116,13 +116,13 @@ if [ ! -f "$BUILDDIR"/build.ninja ]; then
|
|||||||
-D rfkill=true
|
-D rfkill=true
|
||||||
-D xdg-autostart=true
|
-D xdg-autostart=true
|
||||||
-D translations=true
|
-D translations=true
|
||||||
-D polkit=true
|
-D polkit=enabled
|
||||||
-D acl=enabled
|
-D acl=enabled
|
||||||
-D audit=enabled
|
-D audit=enabled
|
||||||
-D blkid=enabled
|
-D blkid=enabled
|
||||||
-D fdisk=enabled
|
-D fdisk=enabled
|
||||||
-D kmod=enabled
|
-D kmod=enabled
|
||||||
-D pam=true
|
-D pam=enabled
|
||||||
-D pwquality=true
|
-D pwquality=true
|
||||||
-D microhttpd=enabled
|
-D microhttpd=enabled
|
||||||
-D libcryptsetup=true
|
-D libcryptsetup=true
|
||||||
@ -130,7 +130,7 @@ if [ ! -f "$BUILDDIR"/build.ninja ]; then
|
|||||||
-D idn=true
|
-D idn=true
|
||||||
-D libidn2=true
|
-D libidn2=true
|
||||||
-D qrencode=enabled
|
-D qrencode=enabled
|
||||||
-D gcrypt=true
|
-D gcrypt=enabled
|
||||||
-D gnutls=enabled
|
-D gnutls=enabled
|
||||||
-D openssl=enabled
|
-D openssl=enabled
|
||||||
-D cryptolib=openssl
|
-D cryptolib=openssl
|
||||||
|
Loading…
Reference in New Issue
Block a user