Skip to content

Commit 0b81a82

Browse files
fix: resolve missing dependencies for Windows Kafka SASL support && git push (#170)
Signed-off-by: Patrick Stephens <pat@fluent.do>
1 parent dedf52e commit 0b81a82

File tree

1 file changed

+31
-22
lines changed

1 file changed

+31
-22
lines changed

source/cmake/kafka.cmake

Lines changed: 31 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -9,53 +9,62 @@ include(FindPkgConfig)
99

1010
# Check for libsasl2 (required for SASL authentication)
1111
set(FLB_SASL_ENABLED OFF)
12-
if(PkgConfig_FOUND)
13-
pkg_check_modules(SASL libsasl2)
14-
if(SASL_FOUND)
15-
message(STATUS "Found libsasl2: ${SASL_VERSION}")
16-
set(FLB_SASL_ENABLED ON)
12+
if( FLB_SYSTEM_WINDOWS )
13+
# On Windows, we only need TLS support to enable SASL support in librdkafka
14+
if( NOT FLB_TLS )
15+
message(WARNING "TLS support is required to enable SASL on Windows")
1716
endif()
17+
set(FLB_SASL_OAUTHBEARER_ENABLED ${FLB_TLS})
18+
# Note we do not want to configure FLB_SASL_ENABLED on Windows as this then requires the library to link with
1819
else()
19-
message(WARNING "pkg-config not available - trying fallback SASL detection")
20-
endif()
21-
22-
# Fallback when pkgconfig is not available or not working properly (centos 6)
23-
if(NOT FLB_SASL_ENABLED)
24-
find_library(SASL2_LIB NAMES sasl2)
25-
find_path(SASL2_INCLUDE NAMES sasl/sasl.h)
26-
if(SASL2_LIB AND SASL2_INCLUDE)
27-
set(FLB_SASL_ENABLED ON)
28-
message(STATUS "Found libsasl2 via fallback: ${SASL2_LIB}")
20+
if(PkgConfig_FOUND)
21+
pkg_check_modules(SASL libsasl2)
22+
if(SASL_FOUND)
23+
message(STATUS "Found libsasl2: ${SASL_VERSION}")
24+
set(FLB_SASL_ENABLED ON)
25+
endif()
2926
else()
30-
message(WARNING "libsasl2 not found - SASL authentication will be disabled")
27+
message(WARNING "pkg-config not available - trying fallback SASL detection")
3128
endif()
29+
30+
# Fallback when pkgconfig is not available or not working properly (centos 6)
31+
if(NOT FLB_SASL_ENABLED)
32+
find_library(SASL2_LIB NAMES sasl2)
33+
find_path(SASL2_INCLUDE NAMES sasl/sasl.h)
34+
if(SASL2_LIB AND SASL2_INCLUDE)
35+
set(FLB_SASL_ENABLED ON)
36+
message(STATUS "Found libsasl2 via fallback: ${SASL2_LIB}")
37+
else()
38+
message(WARNING "libsasl2 not found - SASL authentication will be disabled")
39+
endif()
40+
endif()
41+
# OAuth Bearer is built into librdkafka when SASL is available
42+
set(FLB_SASL_OAUTHBEARER_ENABLED ${FLB_SASL_ENABLED})
3243
endif()
3344

34-
# OAuth Bearer is built into librdkafka when SASL is available
35-
set(FLB_SASL_OAUTHBEARER_ENABLED ${FLB_SASL_ENABLED})
3645

3746
# MSK IAM requires OAuth Bearer support
3847
set(FLB_KAFKA_MSK_IAM_ENABLED ${FLB_SASL_OAUTHBEARER_ENABLED})
3948

4049
# Configure librdkafka options
4150
FLB_OPTION(WITH_SASL ${FLB_SASL_ENABLED})
42-
FLB_OPTION(WITH_SSL On)
51+
FLB_OPTION(WITH_SSL ${FLB_TLS})
4352
FLB_OPTION(WITH_SASL_OAUTHBEARER ${FLB_SASL_OAUTHBEARER_ENABLED})
4453
FLB_OPTION(WITH_SASL_CYRUS ${FLB_SASL_ENABLED})
4554

4655
# Export compile-time definitions using FLB_DEFINITION macro
4756
if(FLB_SASL_ENABLED)
4857
FLB_DEFINITION(FLB_HAVE_KAFKA_SASL)
4958
message(STATUS "Kafka SASL authentication: ENABLED")
50-
else()
51-
message(STATUS "Kafka SASL authentication: DISABLED")
59+
elseif(NOT FLB_SYSTEM_WINDOWS)
60+
message(FATAL_ERROR "Kafka SASL authentication: DISABLED")
5261
endif()
5362

5463
if(FLB_SASL_OAUTHBEARER_ENABLED)
5564
FLB_DEFINITION(FLB_HAVE_KAFKA_OAUTHBEARER)
5665
message(STATUS "Kafka OAuth Bearer: ENABLED")
5766
else()
58-
message(STATUS "Kafka OAuth Bearer: DISABLED")
67+
message(FATAL_ERROR "Kafka OAuth Bearer: DISABLED")
5968
endif()
6069

6170
# Disable Curl on macOS (if needed)

0 commit comments

Comments
 (0)