[gvfs] Revert "build: Always use dependency function for libgcrypt"



commit 367af21da33626838011ebaf1e99b2b9020852fc
Author: Ondrej Holy <oholy redhat com>
Date:   Mon Jan 7 17:44:10 2019 +0100

    Revert "build: Always use dependency function for libgcrypt"
    
    This reverts commit 5bc63310a721946199c68160b5134971d5fe0fc6.

 meson.build | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)
---
diff --git a/meson.build b/meson.build
index 55771186..7e539654 100644
--- a/meson.build
+++ b/meson.build
@@ -3,7 +3,7 @@ project(
   version: '1.39.4',
   license: 'LGPL2+',
   default_options: 'buildtype=debugoptimized',
-  meson_version: '>= 0.49.0',
+  meson_version: '>= 0.46.0',
 )
 
 gvfs_name = meson.project_name()
@@ -234,7 +234,24 @@ have_libxml = libxml_dep.found()
 # *** Check for libgcrypt ***
 enable_gcrypt = get_option('gcrypt')
 if enable_gcrypt
-  libgcrypt_dep = dependency('libgcrypt', version: '>= 1.2.2')
+  libgcrypt_req_version = '>= 1.2.2'
+
+  libgcrypt_dep = dependency('libgcrypt', version: libgcrypt_req_version, required: false)
+  if not libgcrypt_dep.found()
+    libgcrypt_config = find_program('libgcrypt-config')
+    libgcrypt_version = run_command(libgcrypt_config, '--version').stdout().strip()
+
+    assert(libgcrypt_version.version_compare(libgcrypt_req_version), 'gcrypt required but libgcrypt ' + 
libgcrypt_req_version + ' not found')
+
+    libgcrypt_cflags = run_command(libgcrypt_config, '--cflags').stdout().strip().split()
+    libgcrypt_libs = run_command(libgcrypt_config, '--libs').stdout().strip().split()
+
+    libgcrypt_dep = declare_dependency(
+      compile_args: libgcrypt_cflags,
+      link_args: libgcrypt_libs,
+      version: libgcrypt_version,
+    )
+  endif
 endif
 config_h.set('HAVE_GCRYPT', enable_gcrypt)
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]