2020-01-02 11:29:22 +00:00
|
|
|
if(OS_LINUX AND OPENSSL_FOUND)
|
2019-12-29 17:39:05 +00:00
|
|
|
option(ENABLE_MYSQL "Enable MySQL" ${ENABLE_LIBRARIES})
|
|
|
|
else ()
|
|
|
|
option(ENABLE_MYSQL "Enable MySQL" FALSE)
|
|
|
|
endif ()
|
|
|
|
|
2020-08-14 15:44:04 +00:00
|
|
|
if(NOT ENABLE_MYSQL)
|
|
|
|
if (USE_INTERNAL_MYSQL_LIBRARY)
|
|
|
|
message (${RECONFIGURE_MESSAGE_LEVEL} "Cannot use internal mysql library with ENABLE_MYSQL=OFF")
|
|
|
|
endif ()
|
|
|
|
message (STATUS "Build without mysqlclient (support for MYSQL dictionary source will be disabled)")
|
|
|
|
return()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
option(USE_INTERNAL_MYSQL_LIBRARY "Set to FALSE to use system mysqlclient library instead of bundled" ${NOT_UNBUNDLED})
|
2018-08-02 00:49:31 +00:00
|
|
|
|
2020-08-14 15:44:04 +00:00
|
|
|
if(NOT EXISTS "${ClickHouse_SOURCE_DIR}/contrib/mariadb-connector-c/README")
|
|
|
|
if(USE_INTERNAL_MYSQL_LIBRARY)
|
2019-04-23 12:51:27 +00:00
|
|
|
message(WARNING "submodule contrib/mariadb-connector-c is missing. to fix try run: \n git submodule update --init --recursive")
|
2020-08-14 15:44:04 +00:00
|
|
|
message (${RECONFIGURE_MESSAGE_LEVEL} "Can't find internal mysql library")
|
2019-04-23 12:51:27 +00:00
|
|
|
set(USE_INTERNAL_MYSQL_LIBRARY 0)
|
|
|
|
endif()
|
2020-08-14 15:44:04 +00:00
|
|
|
set(MISSING_INTERNAL_MYSQL_LIBRARY 1)
|
|
|
|
endif()
|
2018-08-02 00:49:31 +00:00
|
|
|
|
2020-08-14 15:44:04 +00:00
|
|
|
if (NOT USE_INTERNAL_MYSQL_LIBRARY)
|
|
|
|
set (MYSQL_LIB_PATHS
|
|
|
|
"/usr/local/opt/mysql/lib"
|
|
|
|
"/usr/local/lib"
|
|
|
|
"/usr/local/lib64"
|
|
|
|
"/usr/local/lib/mariadb" # macos brew mariadb-connector-c
|
|
|
|
"/usr/mysql/lib"
|
|
|
|
"/usr/mysql/lib64"
|
|
|
|
"/usr/lib"
|
|
|
|
"/usr/lib64"
|
|
|
|
"/lib"
|
|
|
|
"/lib64")
|
|
|
|
|
|
|
|
set (MYSQL_INCLUDE_PATHS
|
|
|
|
"/usr/local/opt/mysql/include"
|
|
|
|
"/usr/mysql/include"
|
|
|
|
"/usr/local/include"
|
2020-08-19 02:22:30 +00:00
|
|
|
"/usr/include/mariadb"
|
|
|
|
"/usr/include/mysql"
|
2020-08-14 15:44:04 +00:00
|
|
|
"/usr/include")
|
|
|
|
|
2020-08-19 02:22:30 +00:00
|
|
|
find_path (MYSQL_INCLUDE_DIR NAMES mysql.h mysql/mysql.h mariadb/mysql.h PATHS ${MYSQL_INCLUDE_PATHS} PATH_SUFFIXES mysql)
|
2020-08-14 15:44:04 +00:00
|
|
|
|
|
|
|
if (USE_STATIC_LIBRARIES)
|
|
|
|
find_library (STATIC_MYSQLCLIENT_LIB NAMES mariadbclient mysqlclient PATHS ${MYSQL_LIB_PATHS} PATH_SUFFIXES mysql)
|
2020-08-09 03:42:09 +00:00
|
|
|
else ()
|
2020-08-14 15:44:04 +00:00
|
|
|
find_library (MYSQLCLIENT_LIBRARIES NAMES mariadb mariadbclient mysqlclient PATHS ${MYSQL_LIB_PATHS} PATH_SUFFIXES mysql)
|
|
|
|
endif ()
|
2020-08-13 20:10:06 +00:00
|
|
|
|
2020-08-14 15:44:04 +00:00
|
|
|
if (MYSQL_INCLUDE_DIR AND (STATIC_MYSQLCLIENT_LIB OR MYSQLCLIENT_LIBRARIES))
|
|
|
|
set (USE_MYSQL 1)
|
|
|
|
set (MYSQLXX_LIBRARY mysqlxx)
|
|
|
|
if (APPLE)
|
|
|
|
# /usr/local/include/mysql/mysql_com.h:1011:10: fatal error: mysql/udf_registration_types.h: No such file or directory
|
|
|
|
set(MYSQL_INCLUDE_DIR ${MYSQL_INCLUDE_DIR} ${MYSQL_INCLUDE_DIR}/mysql)
|
2020-08-13 20:10:06 +00:00
|
|
|
endif ()
|
2020-08-14 15:44:04 +00:00
|
|
|
else ()
|
|
|
|
message (${RECONFIGURE_MESSAGE_LEVEL} "Can't find system mysql library")
|
2017-04-14 19:38:56 +00:00
|
|
|
endif ()
|
|
|
|
endif ()
|
2017-01-12 12:17:54 +00:00
|
|
|
|
2020-08-14 15:44:04 +00:00
|
|
|
if (NOT USE_MYSQL AND NOT MISSING_INTERNAL_MYSQL_LIBRARY)
|
|
|
|
set (MYSQLCLIENT_LIBRARIES mariadbclient)
|
|
|
|
set (MYSQLXX_LIBRARY mysqlxx)
|
|
|
|
set (USE_MYSQL 1)
|
|
|
|
set (USE_INTERNAL_MYSQL_LIBRARY 1)
|
|
|
|
endif()
|
|
|
|
|
2017-04-19 01:06:29 +00:00
|
|
|
if (USE_MYSQL)
|
2017-09-04 17:04:33 +00:00
|
|
|
message (STATUS "Using mysqlclient=${USE_MYSQL}: ${MYSQL_INCLUDE_DIR} : ${MYSQLCLIENT_LIBRARIES}; staticlib=${STATIC_MYSQLCLIENT_LIB}")
|
2017-04-19 01:06:29 +00:00
|
|
|
else ()
|
|
|
|
message (STATUS "Build without mysqlclient (support for MYSQL dictionary source will be disabled)")
|
|
|
|
endif ()
|