meson: Simplify libgcrypt detection

Meson has native support for the libgcrypt-config program if pkgconfig
file is not provided.
This commit is contained in:
Daiki Ueno 2019-10-10 16:24:02 +02:00
parent 4b6d735b82
commit 1b1a7d1e48

View File

@ -44,23 +44,9 @@ glib_deps = [
dependency('gio-2.0', version: '>=' + min_glib_version),
dependency('gio-unix-2.0', version: '>=' + min_glib_version),
]
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))
error('@0@ requires at least gcrypt version @1@, but version found is @2@'
.format(meson.project_name(), min_libgcrypt_version, libgcrypt_version))
endif
message('gcrypt version: @0@'.format(libgcrypt_version))
gcrypt_dep = declare_dependency(
link_args: run_command(libgcrypt_config, '--libs').stdout().strip().split(),
compile_args: run_command(libgcrypt_config, '--cflags').stdout().strip().split(),
)
endif
endif
min_libgcrypt_version = '1.2.2'
gcrypt_dep = dependency('libgcrypt', version: '>=1.2.2', required: with_gcrypt)
# Libraries
math = meson.get_compiler('c').find_library('m')