From 2c8882ae183d8e0b6f23a44574a9c44ad2a1257c Mon Sep 17 00:00:00 2001 From: Andrei Pavel Date: Wed, 2 Apr 2025 21:56:39 +0300 Subject: [PATCH] [#3732] Detect mit krb5 in meson --- src/hooks/d2/gss_tsig/testutils/meson.build | 2 +- subprojects/krb5/meson.build | 51 +++++++++++---------- 2 files changed, 29 insertions(+), 24 deletions(-) diff --git a/src/hooks/d2/gss_tsig/testutils/meson.build b/src/hooks/d2/gss_tsig/testutils/meson.build index d91e8231a6..3dfdb37ce8 100644 --- a/src/hooks/d2/gss_tsig/testutils/meson.build +++ b/src/hooks/d2/gss_tsig/testutils/meson.build @@ -7,6 +7,6 @@ ddns_gss_tsig_testutils_lib = static_library( 'ddns-gss-tsig-testutils', 'gss_tsig_dns_server.cc', cpp_args: [f'-DTEST_DATA_DIR="@current_source_dir@"'], - dependencies: [GTEST_DEP, CRYPTO_DEP], + dependencies: [CRYPTO_DEP, GTEST_DEP, KRB5_DEP], include_directories: [include_directories('.'), include_directories('..')] + INCLUDES, ) diff --git a/subprojects/krb5/meson.build b/subprojects/krb5/meson.build index 9834d73e49..dfb89b8383 100644 --- a/subprojects/krb5/meson.build +++ b/subprojects/krb5/meson.build @@ -1,28 +1,33 @@ project('krb5') -current_source_dir = meson.current_source_dir() krb5 = disabler() -krb5_config = find_program('krb5-config', required: false) -if krb5_config.found() - # Detect vendor. - vendor_cmd = run_command([krb5_config, '--vendor'], check: false) - if vendor_cmd.returncode() != 0 - path = krb5_config.full_path() - message(f'Very old and not usable config script at @path@') - else - vendor = vendor_cmd.stdout().strip() - endif +foreach krb5_config_name : ['krb5-config', 'krb5-config.mit'] + krb5_config = find_program(krb5_config_name, required: false) - cflags = run_command([krb5_config, '--cflags', 'gssapi'], check: false) - libs = run_command([krb5_config, '--libs', 'gssapi'], check: false) - version = run_command([krb5_config, '--version'], check: false) - if vendor_cmd.returncode() == 0 and cflags.returncode() == 0 and libs.returncode() == 0 and version.returncode() == 0 - krb5_version = version.stdout().strip() - krb5 = declare_dependency( - compile_args: cflags.stdout().split(), - link_args: libs.stdout().split(), - version: krb5_version, - variables: {'vendor': vendor}, - ) + if krb5_config.found() + # Detect vendor. + vendor_cmd = run_command([krb5_config, '--vendor'], check: false) + if vendor_cmd.returncode() != 0 + path = krb5_config.full_path() + message(f'Very old and not usable config script at @path@') + else + vendor = vendor_cmd.stdout().strip() + endif + + cflags = run_command([krb5_config, '--cflags', 'gssapi'], check: false) + libs = run_command([krb5_config, '--libs', 'gssapi'], check: false) + version = run_command([krb5_config, '--version'], check: false) + if vendor_cmd.returncode() == 0 and cflags.returncode() == 0 and libs.returncode() == 0 and version.returncode() == 0 + krb5_version = version.stdout().strip() + krb5 = declare_dependency( + compile_args: cflags.stdout().split(), + link_args: libs.stdout().split(), + version: krb5_version, + variables: {'vendor': vendor}, + ) + endif endif -endif + if krb5.found() + break + endif +endforeach