2020-08-14 23:39:16 +00:00
|
|
|
if (UNBUNDLED AND USE_STATIC_LIBRARIES)
|
|
|
|
set (ENABLE_LDAP OFF CACHE INTERNAL "")
|
|
|
|
endif()
|
|
|
|
|
2020-05-12 19:19:15 +00:00
|
|
|
option (ENABLE_LDAP "Enable LDAP" ${ENABLE_LIBRARIES})
|
|
|
|
|
2020-08-14 15:44:04 +00:00
|
|
|
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()
|
2020-05-12 19:19:15 +00:00
|
|
|
|
2020-08-14 15:44:04 +00:00
|
|
|
option (USE_INTERNAL_LDAP_LIBRARY "Set to FALSE to use system *LDAP library instead of bundled" ${NOT_UNBUNDLED})
|
2020-05-12 19:19:15 +00:00
|
|
|
|
2020-08-14 15:44:04 +00:00
|
|
|
if (NOT EXISTS "${ClickHouse_SOURCE_DIR}/contrib/openldap/README")
|
|
|
|
if (USE_INTERNAL_LDAP_LIBRARY)
|
2021-10-17 23:29:04 +00:00
|
|
|
message (WARNING "Submodule contrib/openldap is missing. To fix try running:\n git submodule update --init")
|
2020-08-14 15:44:04 +00:00
|
|
|
message (${RECONFIGURE_MESSAGE_LEVEL} "Can't find internal LDAP library")
|
2020-05-12 19:19:15 +00:00
|
|
|
endif ()
|
|
|
|
|
2020-08-14 15:44:04 +00:00
|
|
|
set (USE_INTERNAL_LDAP_LIBRARY 0)
|
|
|
|
set (MISSING_INTERNAL_LDAP_LIBRARY 1)
|
|
|
|
endif ()
|
2020-05-12 19:19:15 +00:00
|
|
|
|
2020-08-14 15:44:04 +00:00
|
|
|
set (OPENLDAP_USE_STATIC_LIBS ${USE_STATIC_LIBRARIES})
|
|
|
|
set (OPENLDAP_USE_REENTRANT_LIBS 1)
|
2020-05-31 11:04:56 +00:00
|
|
|
|
2020-08-14 15:44:04 +00:00
|
|
|
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")
|
2020-05-12 19:19:15 +00:00
|
|
|
endif ()
|
2020-08-14 15:44:04 +00:00
|
|
|
|
|
|
|
find_package (OpenLDAP)
|
|
|
|
|
|
|
|
if (NOT OPENLDAP_FOUND)
|
|
|
|
message (${RECONFIGURE_MESSAGE_LEVEL} "Can't find system OpenLDAP")
|
|
|
|
endif()
|
2020-05-12 19:19:15 +00:00
|
|
|
endif ()
|
2020-08-14 15:44:04 +00:00
|
|
|
endif ()
|
2020-05-12 19:19:15 +00:00
|
|
|
|
2020-08-14 15:44:04 +00:00
|
|
|
if (NOT OPENLDAP_FOUND AND NOT MISSING_INTERNAL_LDAP_LIBRARY)
|
|
|
|
string (TOLOWER "${CMAKE_SYSTEM_NAME}" _system_name)
|
|
|
|
string (TOLOWER "${CMAKE_SYSTEM_PROCESSOR}" _system_processor)
|
2020-05-14 20:25:27 +00:00
|
|
|
|
2020-08-14 15:44:04 +00:00
|
|
|
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 ()
|
2020-05-12 19:19:15 +00:00
|
|
|
|
2020-08-14 15:44:04 +00:00
|
|
|
if (
|
|
|
|
( "${_system_name}" STREQUAL "linux" AND "${_system_processor}" STREQUAL "x86_64" ) OR
|
|
|
|
( "${_system_name}" STREQUAL "linux" AND "${_system_processor}" STREQUAL "aarch64" ) OR
|
2021-04-02 03:32:09 +00:00
|
|
|
( "${_system_name}" STREQUAL "linux" AND "${_system_processor}" STREQUAL "ppc64le" ) OR
|
2020-08-14 15:44:04 +00:00
|
|
|
( "${_system_name}" STREQUAL "freebsd" AND "${_system_processor}" STREQUAL "x86_64" ) OR
|
2021-07-22 12:08:45 +00:00
|
|
|
( "${_system_name}" STREQUAL "freebsd" AND "${_system_processor}" STREQUAL "aarch64" ) OR
|
2021-03-11 17:12:52 +00:00
|
|
|
( "${_system_name}" STREQUAL "darwin" AND "${_system_processor}" STREQUAL "x86_64" ) OR
|
|
|
|
( "${_system_name}" STREQUAL "darwin" AND "${_system_processor}" STREQUAL "aarch64" )
|
2020-08-14 15:44:04 +00:00
|
|
|
)
|
|
|
|
set (_ldap_supported_platform TRUE)
|
|
|
|
endif ()
|
2020-08-13 20:10:06 +00:00
|
|
|
|
2020-08-14 15:44:04 +00:00
|
|
|
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 USE_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")
|
2020-05-12 19:19:15 +00:00
|
|
|
else ()
|
2020-08-14 15:44:04 +00:00
|
|
|
set (OPENLDAP_LDAP_LIBRARY "ldap")
|
|
|
|
endif()
|
|
|
|
set (OPENLDAP_LBER_LIBRARY "lber")
|
|
|
|
set (OPENLDAP_LIBRARIES ${OPENLDAP_LDAP_LIBRARY} ${OPENLDAP_LBER_LIBRARY})
|
|
|
|
set (OPENLDAP_FOUND 1)
|
2020-05-12 19:19:15 +00:00
|
|
|
endif ()
|
2020-08-14 15:44:04 +00:00
|
|
|
endif ()
|
2020-05-12 19:19:15 +00:00
|
|
|
|
2020-08-14 15:44:04 +00:00
|
|
|
if (OPENLDAP_FOUND)
|
|
|
|
set (USE_LDAP 1)
|
2020-05-12 19:19:15 +00:00
|
|
|
endif ()
|
|
|
|
|
2020-05-29 10:00:12 +00:00
|
|
|
message (STATUS "Using ldap=${USE_LDAP}: ${OPENLDAP_INCLUDE_DIRS} : ${OPENLDAP_LIBRARIES}")
|