summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChun-wei Fan <fanchunwei@src.gnome.org>2017-11-28 18:35:29 +0800
committerTomas Popela <tpopela@redhat.com>2018-04-11 12:39:20 +0200
commit193d71878368ca8856a8a1e98f0fa1ea3383b898 (patch)
tree74241fe87ef68e5d2f2ac846b122a5dbf55fef53
parentb4923f8bc8e3c957b4fd992e6280514b88198500 (diff)
downloadlibsoup-193d71878368ca8856a8a1e98f0fa1ea3383b898.tar.gz
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.
-rw-r--r--meson.build51
1 files changed, 34 insertions, 17 deletions
diff --git a/meson.build b/meson.build
index dcba6650..a3616da8 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