From ce32489b1e34ffa5fb690b680362304b0b354ed0 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. [ fixed to fallback to extra dependency() call as multiple deps require meson 0.60 ] (cherry picked from commit 555737878f66e64dea50dd7bf6f0b12cc54d2963) (cherry picked from commit 087b9a70b0376b2b7ea0f6037485cee7fdbfa9d4) (cherry picked from commit 6f7b7b661ec513fb3526be30ea20fa553de4c877) --- meson.build | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/meson.build b/meson.build index 6fad9313f3..ca078698aa 100644 --- a/meson.build +++ b/meson.build @@ -998,7 +998,14 @@ threads = dependency('threads') librt = cc.find_library('rt') libm = cc.find_library('m') libdl = cc.find_library('dl') -libcrypt = dependency('libcrypt') +libcrypt = dependency('libcrypt', required : false) +if not libcrypt.found() + libcrypt = dependency('libxcrypt', required : false) +endif +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,