]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
meson: allow to fallback to use libxcrypt.pc or glibc's libcrypt
authorYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 7 Jul 2023 09:49:04 +0000 (18:49 +0900)
committerLuca Boccassi <luca.boccassi@gmail.com>
Fri, 7 Jul 2023 11:32:12 +0000 (12:32 +0100)
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

index afda4c0431ae9e38f0625e61d027bde71178d3f4..661663f12f5e14a34cf149164e3c40dd2ca941f6 100644 (file)
@@ -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,