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.
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,