[libsoup/wip/meson: 68/75] meson: Improve check for MIT Kerberos on Visual Studio



commit 98ed6e7b3ae422187e0afddbe121aa57cdae1136
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Tue Nov 28 18:35:29 2017 +0800

    meson: Improve check for MIT Kerberos on Visual Studio
    
    Visual Studio builds will not be able to run the krb5-config script,
    even if it is available, and it is not generated with the MIT Kerberos
    build system for Visual Studio.
    
    So, we need to manually check whether we have the gssapi/gssapi.h
    header, and whether gssapi32.lib (32-build builds) or gssapi64.lib
    (x64 builds) is available, to properly enable MIT Kerberos support on
    Visual Studio builds.

 meson.build |   51 ++++++++++++++++++++++++++++++++++-----------------
 1 files changed, 34 insertions(+), 17 deletions(-)
---
diff --git a/meson.build b/meson.build
index dcba665..a3616da 100644
--- a/meson.build
+++ b/meson.build
@@ -140,28 +140,45 @@ endif
 enable_gssapi = get_option('gssapi')
 krb5_config_option = get_option('krb5_config')
 if enable_gssapi
-  krb5_config_path = krb5_config_option != '' ? krb5_config_option : 'krb5-config'
-  krb5_config = find_program(krb5_config_path, required : false)
-
-  if krb5_config.found()
-    krb5_config_output = run_command (krb5_config, '--libs', 'gssapi')
-    if krb5_config_output.returncode() == 0
-      add_project_link_arguments(krb5_config_output.stdout().split(), language : 'c')
+  if cc.get_id() == 'msvc'
+    if host_machine.cpu_family() == 'x86'
+      gssapi_lib_type = '32'
     else
-      error('Failed to obtain cflags for GSSAPI from krb5-config')
-      enable_gssapi = false
+      gssapi_lib_type = '64'
     endif
-
-    krb5_config_output = run_command (krb5_config, '--cflags', 'gssapi')
-    if krb5_config_output.returncode() == 0
-      add_project_arguments(krb5_config_output.stdout().split(), language : 'c')
+    gssapi_header = cc.has_header('gssapi/gssapi.h', required: false)
+    if gssapi_header
+      gssapi_lib = cc.find_library('gssapi@0@'.format(gssapi_lib_type), required: false)
+    endif
+    if gssapi_header and gssapi_lib.found()
+      add_project_link_arguments('gssapi@0@.lib'.format(gssapi_lib_type), language : 'c')
     else
-      error('Failed to obtain cflags for GSSAPI from krb5-config')
-      enable_gssapi = false
+      error('GSSAPI support requested, but the MIT Keberos 5 headers and libraries are not found')
     endif
   else
-    error('GSSAPI support requested, but krb5-config not found. Please specify its path with 
-Dkrb5-config=PATH')
-    enable_gssapi = false
+    krb5_config_path = krb5_config_option != '' ? krb5_config_option : 'krb5-config'
+    krb5_config = find_program(krb5_config_path, required : false)
+
+    if krb5_config.found()
+      krb5_config_output = run_command (krb5_config, '--libs', 'gssapi')
+      if krb5_config_output.returncode() == 0
+        add_project_link_arguments(krb5_config_output.stdout().split(), language : 'c')
+      else
+        error('Failed to obtain cflags for GSSAPI from krb5-config')
+        enable_gssapi = false
+      endif
+
+      krb5_config_output = run_command (krb5_config, '--cflags', 'gssapi')
+      if krb5_config_output.returncode() == 0
+        add_project_arguments(krb5_config_output.stdout().split(), language : 'c')
+      else
+        error('Failed to obtain cflags for GSSAPI from krb5-config')
+        enable_gssapi = false
+      endif
+    else
+      error('GSSAPI support requested, but krb5-config not found. Please specify its path with 
-Dkrb5-config=PATH')
+      enable_gssapi = false
+    endif
   endif
 
   if enable_gssapi


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