[PATCH 0/4] meson: Prepare for newer meson

When we switch to meson-0.57.0 or newer (which we can't do currently because of Debian 11 and Ubuntu 20.04), we can start using: libs_summary = { 'acl': acl_dep, ... } which not only reports 'YES'/'NO', but also library version: acl : YES 2.3.1 But in order to do that, we have switch away from conf.has() to XXX_dep(). Michal Prívozník (4): meson: acl_dep switch to dependency() meson: attr_dep switch to dependency() meson: numactl_dep switch to dependency() meson: Use dependency().found() instead of conf.has() meson.build | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) -- 2.39.3

The pkg-config file to libacl was introduced in 2.2.53 release. Now that every supported distro ships at least this version, we can switch meson detection to dependency(). Signed-off-by: Michal Privoznik <mprivozn@redhat.com> --- meson.build | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/meson.build b/meson.build index 7603a7893a..33cf8020ba 100644 --- a/meson.build +++ b/meson.build @@ -871,8 +871,7 @@ endif # generic build dependencies -# FIXME rewrite to use dependency() -acl_dep = cc.find_library('acl', required: false) +acl_dep = dependency('libacl', required: false) if acl_dep.found() conf.set('WITH_LIBACL', 1) endif -- 2.39.3

The pkg-config file to libattr was introduced in 2.4.48 release. Now that every supported distro ships at least this version, we can switch meson detection to dependency(). Signed-off-by: Michal Privoznik <mprivozn@redhat.com> --- meson.build | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/meson.build b/meson.build index 33cf8020ba..5715eacf60 100644 --- a/meson.build +++ b/meson.build @@ -898,8 +898,7 @@ if not get_option('apparmor_profiles').disabled() endif endif -# FIXME rewrite to use dependency() once we can use 2.4.48 -attr_dep = cc.find_library('attr', required: get_option('attr')) +attr_dep = dependency('libattr', required: get_option('attr')) if attr_dep.found() conf.set('WITH_LIBATTR', 1) endif -- 2.39.3

The pkg-config file to libnuma was introduced in 2.0.12 release (though the comment mistakenly claims 2.0.14 version). Every supported distro ships at least this version, and thus we can switch meson detection to dependency(). Signed-off-by: Michal Privoznik <mprivozn@redhat.com> --- meson.build | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/meson.build b/meson.build index 5715eacf60..53d369557d 100644 --- a/meson.build +++ b/meson.build @@ -1095,8 +1095,7 @@ else intl_dep = dependency('', required: false) endif -# FIXME rewrite to use dependency() once we can use 2.0.14 -numactl_dep = cc.find_library('numa', required: get_option('numactl')) +numactl_dep = dependency('numa', required: get_option('numactl')) if numactl_dep.found() conf.set('WITH_NUMACTL', 1) if cc.has_function('numa_set_preferred_many', dependencies: numactl_dep) -- 2.39.3

So far this change alone doesn't make much sense, but prepares code for upcoming change. Unfortunately, some conf.has() statements have to stay, because there's no corresponding dependency(). But that's okay. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> --- meson.build | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/meson.build b/meson.build index 53d369557d..aa391e7178 100644 --- a/meson.build +++ b/meson.build @@ -1175,6 +1175,8 @@ if not get_option('sanlock').disabled() conf.set('WITH_SANLOCK_STRERROR', 1) endif endif +else + sanlock_dep = dependency('', required: false) endif sasl_version = '2.1.26' @@ -2209,7 +2211,7 @@ libs_summary = { 'libssh': libssh_dep.found(), 'libssh2': libssh2_dep.found(), 'libutil': libutil_dep.found(), - 'netcf': conf.has('WITH_NETCF'), + 'netcf': netcf_dep.found(), 'NLS': have_gnu_gettext_tools, 'numactl': numactl_dep.found(), 'openwsman': openwsman_dep.found(), @@ -2218,7 +2220,7 @@ libs_summary = { 'polkit': conf.has('WITH_POLKIT'), 'rbd': rbd_dep.found(), 'readline': readline_dep.found(), - 'sanlock': conf.has('WITH_SANLOCK'), + 'sanlock': sanlock_dep.found(), 'sasl': sasl_dep.found(), 'selinux': selinux_dep.found(), 'udev': udev_dep.found(), -- 2.39.3

On Thu, Jun 08, 2023 at 01:18:49PM +0200, Michal Privoznik wrote:
When we switch to meson-0.57.0 or newer (which we can't do currently because of Debian 11 and Ubuntu 20.04), we can start using:
libs_summary = { 'acl': acl_dep, ... }
which not only reports 'YES'/'NO', but also library version:
acl : YES 2.3.1
But in order to do that, we have switch away from conf.has() to XXX_dep().
Looks good to me, CI looks happy too: Reviewed-by: Erik Skultety <eskultet@redhat.com>
participants (2)
-
Erik Skultety
-
Michal Privoznik