Allow building librdkafka without ssl

This commit is contained in:
Mikhail Filimonov 2021-01-20 20:08:16 +01:00
parent ea0a49ed7a
commit 58c57bbb9d
No known key found for this signature in database
GPG Key ID: 6E49C2E9AF1220BE
3 changed files with 36 additions and 16 deletions

View File

@ -1,9 +1,7 @@
if (NOT ARCH_ARM AND OPENSSL_FOUND) if (NOT ARCH_ARM)
option (ENABLE_RDKAFKA "Enable kafka" ${ENABLE_LIBRARIES}) option (ENABLE_RDKAFKA "Enable kafka" ${ENABLE_LIBRARIES})
elseif(ENABLE_RDKAFKA AND NOT OPENSSL_FOUND)
message (${RECONFIGURE_MESSAGE_LEVEL} "Can't use librdkafka without SSL")
elseif(ENABLE_RDKAFKA) elseif(ENABLE_RDKAFKA)
message (${RECONFIGURE_MESSAGE_LEVEL} "librdafka is not supported on ARM and on FreeBSD") message (${RECONFIGURE_MESSAGE_LEVEL} "librdafka is not supported on ARM")
endif () endif ()
if (NOT ENABLE_RDKAFKA) if (NOT ENABLE_RDKAFKA)

View File

@ -51,11 +51,11 @@ set(SRCS
${RDKAFKA_SOURCE_DIR}/rdkafka_roundrobin_assignor.c ${RDKAFKA_SOURCE_DIR}/rdkafka_roundrobin_assignor.c
${RDKAFKA_SOURCE_DIR}/rdkafka_sasl.c ${RDKAFKA_SOURCE_DIR}/rdkafka_sasl.c
# ${RDKAFKA_SOURCE_DIR}/rdkafka_sasl_cyrus.c # optionally included below # ${RDKAFKA_SOURCE_DIR}/rdkafka_sasl_cyrus.c # optionally included below
${RDKAFKA_SOURCE_DIR}/rdkafka_sasl_oauthbearer.c # ${RDKAFKA_SOURCE_DIR}/rdkafka_sasl_oauthbearer.c # optionally included below
${RDKAFKA_SOURCE_DIR}/rdkafka_sasl_plain.c ${RDKAFKA_SOURCE_DIR}/rdkafka_sasl_plain.c
${RDKAFKA_SOURCE_DIR}/rdkafka_sasl_scram.c # ${RDKAFKA_SOURCE_DIR}/rdkafka_sasl_scram.c # optionally included below
# ${RDKAFKA_SOURCE_DIR}/rdkafka_sasl_win32.c # ${RDKAFKA_SOURCE_DIR}/rdkafka_sasl_win32.c
${RDKAFKA_SOURCE_DIR}/rdkafka_ssl.c # ${RDKAFKA_SOURCE_DIR}/rdkafka_ssl.c # optionally included below
${RDKAFKA_SOURCE_DIR}/rdkafka_sticky_assignor.c ${RDKAFKA_SOURCE_DIR}/rdkafka_sticky_assignor.c
${RDKAFKA_SOURCE_DIR}/rdkafka_subscription.c ${RDKAFKA_SOURCE_DIR}/rdkafka_subscription.c
${RDKAFKA_SOURCE_DIR}/rdkafka_timer.c ${RDKAFKA_SOURCE_DIR}/rdkafka_timer.c
@ -82,10 +82,33 @@ set(SRCS
if(${ENABLE_CYRUS_SASL}) if(${ENABLE_CYRUS_SASL})
message (STATUS "librdkafka with SASL support") message (STATUS "librdkafka with SASL support")
set(SRCS set(WITH_SASL_CYRUS 1)
${SRCS} endif()
${RDKAFKA_SOURCE_DIR}/rdkafka_sasl_cyrus.c # needed to support Kerberos, requires cyrus-sasl
) if(OPENSSL_FOUND)
message (STATUS "librdkafka with SSL support")
set(WITH_SSL 1)
if(${ENABLE_CYRUS_SASL})
set(WITH_SASL_SCRAM 1)
set(WITH_SASL_OAUTHBEARER 1)
endif()
endif()
if(WITH_SSL)
list(APPEND SRCS ${RDKAFKA_SOURCE_DIR}/rdkafka_ssl.c)
endif()
if(WITH_SASL_CYRUS)
list(APPEND SRCS ${RDKAFKA_SOURCE_DIR}/rdkafka_sasl_cyrus.c) # needed to support Kerberos, requires cyrus-sasl
endif()
if(WITH_SASL_SCRAM)
list(APPEND SRCS ${RDKAFKA_SOURCE_DIR}/rdkafka_sasl_scram.c)
endif()
if(WITH_SASL_OAUTHBEARER)
list(APPEND SRCS ${RDKAFKA_SOURCE_DIR}/rdkafka_sasl_oauthbearer.c)
endif() endif()
add_library(rdkafka ${SRCS}) add_library(rdkafka ${SRCS})
@ -101,7 +124,6 @@ if(OPENSSL_SSL_LIBRARY AND OPENSSL_CRYPTO_LIBRARY)
endif() endif()
if(${ENABLE_CYRUS_SASL}) if(${ENABLE_CYRUS_SASL})
target_link_libraries(rdkafka PRIVATE ${CYRUS_SASL_LIBRARY}) target_link_libraries(rdkafka PRIVATE ${CYRUS_SASL_LIBRARY})
set(WITH_SASL_CYRUS 1)
endif() endif()
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/auxdir) file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/auxdir)

View File

@ -60,11 +60,11 @@
// WITH_SOCKEM // WITH_SOCKEM
#define WITH_SOCKEM 1 #define WITH_SOCKEM 1
// libssl // libssl
#define WITH_SSL 1 #cmakedefine WITH_SSL 1
// WITH_SASL_SCRAM // WITH_SASL_SCRAM
#define WITH_SASL_SCRAM 1 #cmakedefine WITH_SASL_SCRAM 1
// WITH_SASL_OAUTHBEARER // WITH_SASL_OAUTHBEARER
#define WITH_SASL_OAUTHBEARER 1 #cmakedefine WITH_SASL_OAUTHBEARER 1
#cmakedefine WITH_SASL_CYRUS 1 #cmakedefine WITH_SASL_CYRUS 1
// crc32chw // crc32chw
#if !defined(__PPC__) #if !defined(__PPC__)