mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-24 08:32:02 +00:00
Remove unbundled openldap support
This commit is contained in:
parent
94ba901fbd
commit
e341dadb4c
@ -490,7 +490,6 @@ include (GNUInstallDirs)
|
||||
include (cmake/contrib_finder.cmake)
|
||||
|
||||
find_contrib_lib(double-conversion) # Must be before parquet
|
||||
include (cmake/find/ldap.cmake) # after ssl
|
||||
include (cmake/find/icu.cmake)
|
||||
include (cmake/find/xz.cmake)
|
||||
include (cmake/find/ltdl.cmake) # for odbc
|
||||
|
@ -1,55 +0,0 @@
|
||||
# Find OpenLDAP libraries.
|
||||
#
|
||||
# Can be configured with:
|
||||
# OPENLDAP_ROOT_DIR - path to the OpenLDAP installation prefix
|
||||
# OPENLDAP_USE_STATIC_LIBS - look for static version of the libraries
|
||||
# OPENLDAP_USE_REENTRANT_LIBS - look for thread-safe version of the libraries
|
||||
#
|
||||
# Sets values of:
|
||||
# OPENLDAP_FOUND - TRUE if found
|
||||
# OPENLDAP_INCLUDE_DIRS - paths to the include directories
|
||||
# OPENLDAP_LIBRARIES - paths to the libldap and liblber libraries
|
||||
# OPENLDAP_LDAP_LIBRARY - paths to the libldap library
|
||||
# OPENLDAP_LBER_LIBRARY - paths to the liblber library
|
||||
#
|
||||
|
||||
if(OPENLDAP_USE_STATIC_LIBS)
|
||||
set(_orig_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
if(WIN32)
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES ".lib" ".a" ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
else()
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(_r_suffix)
|
||||
if(OPENLDAP_USE_REENTRANT_LIBS)
|
||||
set(_r_suffix "_r")
|
||||
endif()
|
||||
|
||||
if(OPENLDAP_ROOT_DIR)
|
||||
find_path(OPENLDAP_INCLUDE_DIRS NAMES "ldap.h" "lber.h" PATHS "${OPENLDAP_ROOT_DIR}" PATH_SUFFIXES "include" NO_DEFAULT_PATH)
|
||||
find_library(OPENLDAP_LDAP_LIBRARY NAMES "ldap${_r_suffix}" PATHS "${OPENLDAP_ROOT_DIR}" PATH_SUFFIXES "lib" NO_DEFAULT_PATH)
|
||||
find_library(OPENLDAP_LBER_LIBRARY NAMES "lber" PATHS "${OPENLDAP_ROOT_DIR}" PATH_SUFFIXES "lib" NO_DEFAULT_PATH)
|
||||
else()
|
||||
find_path(OPENLDAP_INCLUDE_DIRS NAMES "ldap.h" "lber.h")
|
||||
find_library(OPENLDAP_LDAP_LIBRARY NAMES "ldap${_r_suffix}")
|
||||
find_library(OPENLDAP_LBER_LIBRARY NAMES "lber")
|
||||
endif()
|
||||
|
||||
unset(_r_suffix)
|
||||
|
||||
set(OPENLDAP_LIBRARIES ${OPENLDAP_LDAP_LIBRARY} ${OPENLDAP_LBER_LIBRARY})
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(
|
||||
OpenLDAP DEFAULT_MSG
|
||||
OPENLDAP_INCLUDE_DIRS OPENLDAP_LDAP_LIBRARY OPENLDAP_LBER_LIBRARY
|
||||
)
|
||||
|
||||
mark_as_advanced(OPENLDAP_INCLUDE_DIRS OPENLDAP_LIBRARIES OPENLDAP_LDAP_LIBRARY OPENLDAP_LBER_LIBRARY)
|
||||
|
||||
if(OPENLDAP_USE_STATIC_LIBS)
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES ${_orig_CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
unset(_orig_CMAKE_FIND_LIBRARY_SUFFIXES)
|
||||
endif()
|
@ -1,100 +0,0 @@
|
||||
option (ENABLE_LDAP "Enable LDAP" ${ENABLE_LIBRARIES})
|
||||
|
||||
if (NOT ENABLE_LDAP)
|
||||
if(USE_INTERNAL_LDAP_LIBRARY)
|
||||
message (${RECONFIGURE_MESSAGE_LEVEL} "Cannot use internal LDAP library with ENABLE_LDAP=OFF")
|
||||
endif ()
|
||||
return()
|
||||
endif()
|
||||
|
||||
option (USE_INTERNAL_LDAP_LIBRARY "Set to FALSE to use system *LDAP library instead of bundled" ON)
|
||||
|
||||
if (NOT EXISTS "${ClickHouse_SOURCE_DIR}/contrib/openldap/README")
|
||||
if (USE_INTERNAL_LDAP_LIBRARY)
|
||||
message (WARNING "Submodule contrib/openldap is missing. To fix try running:\n git submodule update --init")
|
||||
message (${RECONFIGURE_MESSAGE_LEVEL} "Can't find internal LDAP library")
|
||||
endif ()
|
||||
|
||||
set (USE_INTERNAL_LDAP_LIBRARY 0)
|
||||
set (MISSING_INTERNAL_LDAP_LIBRARY 1)
|
||||
endif ()
|
||||
|
||||
set (OPENLDAP_USE_STATIC_LIBS ${USE_STATIC_LIBRARIES})
|
||||
set (OPENLDAP_USE_REENTRANT_LIBS 1)
|
||||
|
||||
if (NOT USE_INTERNAL_LDAP_LIBRARY)
|
||||
if (OPENLDAP_USE_STATIC_LIBS)
|
||||
message (WARNING "Unable to use external static OpenLDAP libraries, falling back to the bundled version.")
|
||||
message (${RECONFIGURE_MESSAGE_LEVEL} "Unable to use external OpenLDAP")
|
||||
set (USE_INTERNAL_LDAP_LIBRARY 1)
|
||||
else ()
|
||||
if (APPLE AND NOT OPENLDAP_ROOT_DIR)
|
||||
set (OPENLDAP_ROOT_DIR "/usr/local/opt/openldap")
|
||||
endif ()
|
||||
|
||||
find_package (OpenLDAP)
|
||||
|
||||
if (NOT OPENLDAP_FOUND)
|
||||
message (${RECONFIGURE_MESSAGE_LEVEL} "Can't find system OpenLDAP")
|
||||
endif()
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
if (NOT OPENLDAP_FOUND AND NOT MISSING_INTERNAL_LDAP_LIBRARY)
|
||||
string (TOLOWER "${CMAKE_SYSTEM_NAME}" _system_name)
|
||||
string (TOLOWER "${CMAKE_SYSTEM_PROCESSOR}" _system_processor)
|
||||
|
||||
if (
|
||||
"${_system_processor}" STREQUAL "amd64" OR
|
||||
"${_system_processor}" STREQUAL "x64"
|
||||
)
|
||||
set (_system_processor "x86_64")
|
||||
elseif (
|
||||
"${_system_processor}" STREQUAL "arm64"
|
||||
)
|
||||
set (_system_processor "aarch64")
|
||||
endif ()
|
||||
|
||||
if (
|
||||
( "${_system_name}" STREQUAL "linux" AND "${_system_processor}" STREQUAL "x86_64" ) OR
|
||||
( "${_system_name}" STREQUAL "linux" AND "${_system_processor}" STREQUAL "aarch64" ) OR
|
||||
( "${_system_name}" STREQUAL "linux" AND "${_system_processor}" STREQUAL "ppc64le" ) OR
|
||||
( "${_system_name}" STREQUAL "freebsd" AND "${_system_processor}" STREQUAL "x86_64" ) OR
|
||||
( "${_system_name}" STREQUAL "freebsd" AND "${_system_processor}" STREQUAL "aarch64" ) OR
|
||||
( "${_system_name}" STREQUAL "darwin" AND "${_system_processor}" STREQUAL "x86_64" ) OR
|
||||
( "${_system_name}" STREQUAL "darwin" AND "${_system_processor}" STREQUAL "aarch64" )
|
||||
)
|
||||
set (_ldap_supported_platform TRUE)
|
||||
endif ()
|
||||
|
||||
if (NOT _ldap_supported_platform)
|
||||
message (WARNING "LDAP support using the bundled library is not implemented for ${CMAKE_SYSTEM_NAME} ${CMAKE_SYSTEM_PROCESSOR} platform.")
|
||||
message (${RECONFIGURE_MESSAGE_LEVEL} "Cannot enable LDAP support")
|
||||
#elseif (NOT TARGET OpenSSL::SSL)
|
||||
# message (WARNING "LDAP support using the bundled library is not possible if SSL is not used.")
|
||||
# message (${RECONFIGURE_MESSAGE_LEVEL} "Cannot enable LDAP support")
|
||||
else ()
|
||||
set (USE_INTERNAL_LDAP_LIBRARY 1)
|
||||
set (OPENLDAP_ROOT_DIR "${ClickHouse_SOURCE_DIR}/contrib/openldap")
|
||||
set (OPENLDAP_INCLUDE_DIRS
|
||||
"${ClickHouse_SOURCE_DIR}/contrib/openldap-cmake/${_system_name}_${_system_processor}/include"
|
||||
"${ClickHouse_SOURCE_DIR}/contrib/openldap/include"
|
||||
)
|
||||
# Below, 'ldap'/'ldap_r' and 'lber' will be resolved to
|
||||
# the targets defined in contrib/openldap-cmake/CMakeLists.txt
|
||||
if (OPENLDAP_USE_REENTRANT_LIBS)
|
||||
set (OPENLDAP_LDAP_LIBRARY "ldap_r")
|
||||
else ()
|
||||
set (OPENLDAP_LDAP_LIBRARY "ldap")
|
||||
endif()
|
||||
set (OPENLDAP_LBER_LIBRARY "lber")
|
||||
set (OPENLDAP_LIBRARIES ${OPENLDAP_LDAP_LIBRARY} ${OPENLDAP_LBER_LIBRARY})
|
||||
set (OPENLDAP_FOUND 1)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
if (OPENLDAP_FOUND)
|
||||
set (USE_LDAP 1)
|
||||
endif ()
|
||||
|
||||
message (STATUS "Using ldap=${USE_LDAP}: ${OPENLDAP_INCLUDE_DIRS} : ${OPENLDAP_LIBRARIES}")
|
5
contrib/CMakeLists.txt
vendored
5
contrib/CMakeLists.txt
vendored
@ -69,6 +69,7 @@ add_subdirectory (avro-cmake) # requires: snappy
|
||||
add_subdirectory (hive-metastore-cmake) # requires: thrift/avro/arrow
|
||||
add_subdirectory (librdkafka-cmake)
|
||||
add_subdirectory (cppkafka-cmake)
|
||||
add_subdirectory (openldap-cmake)
|
||||
|
||||
# TODO: refactor the contrib libraries below this comment.
|
||||
|
||||
@ -92,10 +93,6 @@ if (USE_INTERNAL_H3_LIBRARY)
|
||||
add_subdirectory(h3-cmake)
|
||||
endif ()
|
||||
|
||||
if (USE_INTERNAL_LDAP_LIBRARY)
|
||||
add_subdirectory (openldap-cmake)
|
||||
endif ()
|
||||
|
||||
if (USE_INTERNAL_MYSQL_LIBRARY)
|
||||
add_subdirectory (mariadb-connector-c-cmake)
|
||||
endif ()
|
||||
|
@ -1,13 +1,37 @@
|
||||
option (ENABLE_LDAP "Enable LDAP" ${ENABLE_LIBRARIES})
|
||||
|
||||
if (NOT ENABLE_LDAP)
|
||||
message(STATUS "Not using ldap")
|
||||
return()
|
||||
endif()
|
||||
|
||||
string (TOLOWER "${CMAKE_SYSTEM_NAME}" _system_name)
|
||||
string (TOLOWER "${CMAKE_SYSTEM_PROCESSOR}" _system_processor)
|
||||
if (
|
||||
"${_system_processor}" STREQUAL "amd64" OR
|
||||
"${_system_processor}" STREQUAL "x64"
|
||||
)
|
||||
set (_system_processor "x86_64")
|
||||
elseif ("${_system_processor}" STREQUAL "arm64")
|
||||
set (_system_processor "aarch64")
|
||||
endif ()
|
||||
if (NOT(
|
||||
( "${_system_name}" STREQUAL "linux" AND "${_system_processor}" STREQUAL "x86_64" ) OR
|
||||
( "${_system_name}" STREQUAL "linux" AND "${_system_processor}" STREQUAL "aarch64" ) OR
|
||||
( "${_system_name}" STREQUAL "linux" AND "${_system_processor}" STREQUAL "ppc64le" ) OR
|
||||
( "${_system_name}" STREQUAL "freebsd" AND "${_system_processor}" STREQUAL "x86_64" ) OR
|
||||
( "${_system_name}" STREQUAL "freebsd" AND "${_system_processor}" STREQUAL "aarch64" ) OR
|
||||
( "${_system_name}" STREQUAL "darwin" AND "${_system_processor}" STREQUAL "x86_64" ) OR
|
||||
( "${_system_name}" STREQUAL "darwin" AND "${_system_processor}" STREQUAL "aarch64" )
|
||||
))
|
||||
message (${RECONFIGURE_MESSAGE_LEVEL} "LDAP support using the bundled library is not implemented for ${CMAKE_SYSTEM_NAME} ${CMAKE_SYSTEM_PROCESSOR} platform.")
|
||||
endif ()
|
||||
|
||||
set(OPENLDAP_SOURCE_DIR "${ClickHouse_SOURCE_DIR}/contrib/openldap")
|
||||
|
||||
# How these lists were generated?
|
||||
# I compiled the original OpenLDAP with it's original build system and copied the list of source files from build commands.
|
||||
|
||||
set(_libs_type SHARED)
|
||||
if(OPENLDAP_USE_STATIC_LIBS)
|
||||
set(_libs_type STATIC)
|
||||
endif()
|
||||
|
||||
set(OPENLDAP_VERSION_STRING "2.5.X")
|
||||
|
||||
macro(mkversion _lib_name)
|
||||
@ -51,22 +75,22 @@ set(_lber_srcs
|
||||
|
||||
mkversion(lber)
|
||||
|
||||
add_library(lber ${_libs_type}
|
||||
add_library(_lber
|
||||
${_lber_srcs}
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/lber-version.c"
|
||||
)
|
||||
|
||||
target_link_libraries(lber
|
||||
target_link_libraries(_lber
|
||||
PRIVATE OpenSSL::Crypto OpenSSL::SSL
|
||||
)
|
||||
|
||||
target_include_directories(lber
|
||||
PRIVATE ${_extra_build_dir}/include
|
||||
PRIVATE "${OPENLDAP_SOURCE_DIR}/include"
|
||||
target_include_directories(_lber SYSTEM
|
||||
PUBLIC ${_extra_build_dir}/include
|
||||
PUBLIC "${OPENLDAP_SOURCE_DIR}/include"
|
||||
PRIVATE "${OPENLDAP_SOURCE_DIR}/libraries/liblber"
|
||||
)
|
||||
|
||||
target_compile_definitions(lber
|
||||
target_compile_definitions(_lber
|
||||
PRIVATE LBER_LIBRARY
|
||||
)
|
||||
|
||||
@ -140,23 +164,23 @@ set(_ldap_srcs
|
||||
|
||||
mkversion(ldap)
|
||||
|
||||
add_library(ldap ${_libs_type}
|
||||
add_library(_ldap
|
||||
${_ldap_srcs}
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/ldap-version.c"
|
||||
)
|
||||
|
||||
target_link_libraries(ldap
|
||||
PRIVATE lber
|
||||
target_link_libraries(_ldap
|
||||
PRIVATE _lber
|
||||
PRIVATE OpenSSL::Crypto OpenSSL::SSL
|
||||
)
|
||||
|
||||
target_include_directories(ldap
|
||||
PRIVATE ${_extra_build_dir}/include
|
||||
PRIVATE "${OPENLDAP_SOURCE_DIR}/include"
|
||||
target_include_directories(_ldap SYSTEM
|
||||
PUBLIC ${_extra_build_dir}/include
|
||||
PUBLIC "${OPENLDAP_SOURCE_DIR}/include"
|
||||
PRIVATE "${OPENLDAP_SOURCE_DIR}/libraries/libldap"
|
||||
)
|
||||
|
||||
target_compile_definitions(ldap
|
||||
target_compile_definitions(_ldap
|
||||
PRIVATE LDAP_LIBRARY
|
||||
)
|
||||
|
||||
@ -175,25 +199,28 @@ set(_ldap_r_specific_srcs
|
||||
|
||||
mkversion(ldap_r)
|
||||
|
||||
add_library(ldap_r ${_libs_type}
|
||||
add_library(_ldap_r
|
||||
${_ldap_r_specific_srcs}
|
||||
${_ldap_srcs}
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/ldap_r-version.c"
|
||||
)
|
||||
|
||||
target_link_libraries(ldap_r
|
||||
PRIVATE lber
|
||||
target_link_libraries(_ldap_r
|
||||
PRIVATE _lber
|
||||
PRIVATE OpenSSL::Crypto OpenSSL::SSL
|
||||
)
|
||||
|
||||
target_include_directories(ldap_r
|
||||
PRIVATE ${_extra_build_dir}/include
|
||||
PRIVATE "${OPENLDAP_SOURCE_DIR}/include"
|
||||
target_include_directories(_ldap_r SYSTEM
|
||||
PUBLIC ${_extra_build_dir}/include
|
||||
PUBLIC "${OPENLDAP_SOURCE_DIR}/include"
|
||||
PRIVATE "${OPENLDAP_SOURCE_DIR}/libraries/libldap_r"
|
||||
PRIVATE "${OPENLDAP_SOURCE_DIR}/libraries/libldap"
|
||||
)
|
||||
|
||||
target_compile_definitions(ldap_r
|
||||
target_compile_definitions(_ldap_r
|
||||
PRIVATE LDAP_R_COMPILE
|
||||
PRIVATE LDAP_LIBRARY
|
||||
)
|
||||
|
||||
add_library(ch_contrib::ldap ALIAS _ldap_r)
|
||||
add_library(ch_contrib::lber ALIAS _lber)
|
||||
|
@ -421,9 +421,8 @@ if (TARGET OpenSSL::Crypto)
|
||||
target_link_libraries (clickhouse_common_io PRIVATE OpenSSL::Crypto)
|
||||
endif ()
|
||||
|
||||
if (USE_LDAP)
|
||||
dbms_target_include_directories (SYSTEM BEFORE PRIVATE ${OPENLDAP_INCLUDE_DIRS})
|
||||
dbms_target_link_libraries (PRIVATE ${OPENLDAP_LIBRARIES})
|
||||
if (TARGET ch_contrib::ldap)
|
||||
dbms_target_link_libraries (PRIVATE ch_contrib::ldap ch_contrib::lber)
|
||||
endif ()
|
||||
dbms_target_include_directories (SYSTEM BEFORE PRIVATE ${SPARSEHASH_INCLUDE_DIR})
|
||||
|
||||
|
@ -16,3 +16,6 @@ endif()
|
||||
if (TARGET OpenSSL::SSL)
|
||||
set(USE_SSL 1)
|
||||
endif()
|
||||
if (TARGET ch_contrib::ldap)
|
||||
set(USE_LDAP 1)
|
||||
endif()
|
||||
|
Loading…
Reference in New Issue
Block a user