Skip to content

Commit 087b9a7

Browse files
yuwatabluca
authored andcommitted
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 d625f71. Fixes #28289. [ fixed to fallback to extra dependency() call as multiple deps require meson 0.60 ] (cherry picked from commit 5557378)
1 parent 7dc6ccc commit 087b9a7

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

meson.build

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1036,7 +1036,14 @@ threads = dependency('threads')
10361036
librt = cc.find_library('rt')
10371037
libm = cc.find_library('m')
10381038
libdl = cc.find_library('dl')
1039-
libcrypt = dependency('libcrypt')
1039+
libcrypt = dependency('libcrypt', required : false)
1040+
if not libcrypt.found()
1041+
libcrypt = dependency('libxcrypt', required : false)
1042+
endif
1043+
if not libcrypt.found()
1044+
# fallback to use find_library() if libcrypt is provided by glibc, e.g. for LibreELEC.
1045+
libcrypt = cc.find_library('crypt')
1046+
endif
10401047
libcap = dependency('libcap')
10411048

10421049
# On some architectures, libatomic is required. But on some installations,

0 commit comments

Comments
 (0)