meson: Check for gcrypt with pkg-config first

Some distributions patch libgcrypt to provide a pkg-config file, and
disable libgcrypt-config. One of these distributions is Yocto, which we
use as the basis for the GNOME Continuous build environment.

We should check if there's a pkg-config file available for gcrypt, and
use it, falling back to libgcrypt-config if the pkg-config file is not
found.
This commit is contained in:
Emmanuele Bassi 2019-05-11 00:41:35 +01:00 committed by Daiki Ueno
parent 6736f9f3e5
commit 4621039c26

View File

@ -45,6 +45,8 @@ glib_deps = [
]
if with_gcrypt
min_libgcrypt_version = '1.2.2'
gcrypt_dep = dependency('libgcrypt', version: '>=' + min_libgcrypt_version, required: false)
if not gcrypt_dep.found()
libgcrypt_config = find_program('libgcrypt-config')
libgcrypt_version = run_command(libgcrypt_config, '--version').stdout().strip()
if (libgcrypt_version.version_compare('>' + libgcrypt_version))
@ -57,6 +59,7 @@ if with_gcrypt
compile_args: run_command(libgcrypt_config, '--cflags').stdout().strip().split(),
)
endif
endif
# Libraries
math = meson.get_compiler('c').find_library('m')