From e6a4b4a1632ced42a0f577e01d67ebff116592be Mon Sep 17 00:00:00 2001 From: Luca Boccassi Date: Fri, 2 Jul 2021 19:44:59 +0100 Subject: [PATCH] meson: fix dlopen support for cryptsetup dlopen is treated as a dependency, but that's not quite right, it should be an alternative way to link to libcryptsetup. Search for it only if cryptsetup is not disabled, and if the cryptsetup-dlopen is explicitly set to enabled. If it is, do not link to libcryptsetup. Add cryptsetup support status to the meson summary. --- libmount/meson.build | 2 +- meson.build | 17 +++++++++++++---- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/libmount/meson.build b/libmount/meson.build index d913654ffb..d25ec8d08c 100644 --- a/libmount/meson.build +++ b/libmount/meson.build @@ -81,7 +81,7 @@ lib_mount = library( link_with : [lib_common, lib_blkid], dependencies : [lib_selinux, - lib_cryptsetup, + get_option('cryptsetup-dlopen').enabled() ? lib_dl : lib_cryptsetup, realtime_libs], install : build_libmount) diff --git a/meson.build b/meson.build index 83e25a746f..b138af86bc 100644 --- a/meson.build +++ b/meson.build @@ -315,10 +315,19 @@ lib_cryptsetup = dependency( required : get_option('cryptsetup')) conf.set('HAVE_CRYPTSETUP', lib_cryptsetup.found() ? 1 : false) -lib_cryptsetup_dl = dependency( - 'dl', - required : get_option('cryptsetup-dlopen')) -conf.set('CRYPTSETUP_VIA_DLOPEN', lib_cryptsetup_dl.found() ? 1 : false) +if not get_option('cryptsetup').disabled() and get_option('cryptsetup-dlopen').enabled() + lib_dl = cc.find_library( + 'libdl', + required : true) + conf.set('CRYPTSETUP_VIA_DLOPEN', 1) + summary('cryptsetup support (dlopen)', + 'enabled', + section : 'components') +else + summary('cryptsetup support', + lib_cryptsetup.found() ? 'enabled' : 'disabled', + section : 'components') +endif have = cc.has_function( 'crypt_activate_by_signed_key', -- 2.47.2