From 555737878f66e64dea50dd7bf6f0b12cc54d2963 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Fri, 7 Jul 2023 18:49:04 +0900 Subject: [PATCH] meson: allow to fallback to use libxcrypt.pc or glibc's libcrypt Some distributions still use glibc's libcrypt. In that case, libcrypt.pc does not exist and dependency() will fail. Also, even if libxcrypt is used, there may not be a symlink from libcrypt.pc to libxcrypt.pc. So, let's add a secondary name. Follow-up for d625f717db6e151fd78742593c35eaba4cd2841d. Fixes #28289. --- meson.build | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/meson.build b/meson.build index afda4c0431a..661663f12f5 100644 --- a/meson.build +++ b/meson.build @@ -1060,7 +1060,11 @@ threads = dependency('threads') librt = cc.find_library('rt') libm = cc.find_library('m') libdl = cc.find_library('dl') -libcrypt = dependency('libcrypt') +libcrypt = dependency('libcrypt', 'libxcrypt', required : false) +if not libcrypt.found() + # fallback to use find_library() if libcrypt is provided by glibc, e.g. for LibreELEC. + libcrypt = cc.find_library('crypt') +endif libcap = dependency('libcap') # On some architectures, libatomic is required. But on some installations,