Skip to content

Commit 6f7b7b6

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) (cherry picked from commit 087b9a7)
1 parent 6700231 commit 6f7b7b6

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
@@ -1022,7 +1022,14 @@ threads = dependency('threads')
10221022
librt = cc.find_library('rt')
10231023
libm = cc.find_library('m')
10241024
libdl = cc.find_library('dl')
1025-
libcrypt = dependency('libcrypt')
1025+
libcrypt = dependency('libcrypt', required : false)
1026+
if not libcrypt.found()
1027+
libcrypt = dependency('libxcrypt', required : false)
1028+
endif
1029+
if not libcrypt.found()
1030+
# fallback to use find_library() if libcrypt is provided by glibc, e.g. for LibreELEC.
1031+
libcrypt = cc.find_library('crypt')
1032+
endif
10261033
libcap = dependency('libcap')
10271034

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

0 commit comments

Comments
 (0)