@@ -9,53 +9,62 @@ include(FindPkgConfig)
99
1010# Check for libsasl2 (required for SASL authentication)
1111set (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
1819else ()
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} )
3243endif ()
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
3847set (FLB_KAFKA_MSK_IAM_ENABLED ${FLB_SASL_OAUTHBEARER_ENABLED} )
3948
4049# Configure librdkafka options
4150FLB_OPTION(WITH_SASL ${FLB_SASL_ENABLED} )
42- FLB_OPTION(WITH_SSL On )
51+ FLB_OPTION(WITH_SSL ${FLB_TLS} )
4352FLB_OPTION(WITH_SASL_OAUTHBEARER ${FLB_SASL_OAUTHBEARER_ENABLED} )
4453FLB_OPTION(WITH_SASL_CYRUS ${FLB_SASL_ENABLED} )
4554
4655# Export compile-time definitions using FLB_DEFINITION macro
4756if (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" )
5261endif ()
5362
5463if (FLB_SASL_OAUTHBEARER_ENABLED)
5564 FLB_DEFINITION(FLB_HAVE_KAFKA_OAUTHBEARER)
5665 message (STATUS "Kafka OAuth Bearer: ENABLED" )
5766else ()
58- message (STATUS "Kafka OAuth Bearer: DISABLED" )
67+ message (FATAL_ERROR "Kafka OAuth Bearer: DISABLED" )
5968endif ()
6069
6170# Disable Curl on macOS (if needed)
0 commit comments