Reverting to an earlier version due to unforseen bugs in the new implementation

This commit is contained in:
Markus Makela
2014-09-24 17:12:44 +03:00
parent e30f4b4b95
commit 7d01fa1619

View File

@ -60,18 +60,26 @@ macro(check_deps)
set(MAXSCALE_DEPS aio ssl crypt crypto z m dl rt pthread)
foreach(lib ${MAXSCALE_DEPS})
find_library(lib${lib} ${lib})
if(${lib${lib}} MATCHES "NOTFOUND")
message(FATAL_ERROR "The required library ${lib${lib}} was not found.")
if((DEFINED lib${lib}) AND (${lib${lib}} STREQUAL "lib${lib}-NOTFOUND"))
set(DEPS_ERROR TRUE)
set(FAILED_DEPS "${FAILED_DEPS} lib${lib}")
elseif(DEBUG_OUTPUT)
message(STATUS "Library was found at: ${lib${lib}}")
endif()
unset(lib${lib} CACHE)
endforeach()
if(DEPS_ERROR)
set(DEPS_OK FALSE CACHE BOOL "If all the dependencies were found.")
message(FATAL_ERROR "Cannot find dependencies: ${FAILED_DEPS}")
endif()
endmacro()
macro(check_dirs)
# This variable is used to prevent redundant checking of dependencies
set(DEPS_OK TRUE CACHE BOOL "If all the dependencies were found.")
# Find the MySQL headers if they were not defined
if(DEFINED MYSQL_DIR)
if(DEBUG_OUTPUT)
@ -84,13 +92,13 @@ macro(check_dirs)
message(STATUS "Search returned: ${MYSQL_DIR_LOC}")
endif()
if(${MYSQL_DIR_LOC} STREQUAL "MYSQL_DIR_LOC-NOTFOUND")
unset(MYSQL_DIR CACHE)
set(DEPS_OK FALSE CACHE BOOL "If all the dependencies were found.")
message(FATAL_ERROR "Fatal Error: MySQL headers were not found.")
else()
message(STATUS "Using MySQL headers found at: ${MYSQL_DIR}")
set(MYSQL_DIR ${MYSQL_DIR_LOC} CACHE PATH "Path to MySQL headers" FORCE)
endif()
unset(MYSQL_DIR_LOC CACHE)
set(MYSQL_DIR_LOC "" INTERNAL)
# Find the errmsg.sys file if it was not defied
if( DEFINED ERRMSG )
@ -98,13 +106,13 @@ macro(check_dirs)
endif()
find_file(ERRMSG_FILE errmsg.sys PATHS /usr/share/mysql /usr/local/share/mysql PATH_SUFFIXES english)
if(${ERRMSG_FILE} MATCHES "ERRMSG_FILE-NOTFOUND")
unset(ERRMSG CACHE)
set(DEPS_OK FALSE CACHE BOOL "If all the dependencies were found.")
message(FATAL_ERROR "Fatal Error: The errmsg.sys file was not found, please define the path to it by using -DERRMSG=<path>")
else()
message(STATUS "Using errmsg.sys found at: ${ERRMSG_FILE}")
endif()
set(ERRMSG ${ERRMSG_FILE} CACHE FILEPATH "Path to the errmsg.sys file." FORCE)
unset(ERRMSG_FILE CACHE)
set(ERRMSG_FILE "" INTERNAL)
# Find the embedded mysql library
if(STATIC_EMBEDDED)
@ -115,10 +123,6 @@ macro(check_dirs)
if(DEBUG_OUTPUT)
message(STATUS "Searching for libmysqld.a at: ${EMBEDDED_LIB}")
endif()
get_filename_component(EMBEDDED_LIB_PATH ${EMBEDDED_LIB} REALPATH CACHE)
set(EMBEDDED_LIB ${EMBEDDED_LIB_PATH} CACHE PATH "Path to libmysqld" FORCE)
unset(EMBEDDED_LIB_PATH CACHE)
message(STATUS "provided path:${EMBEDDED_LIB}")
find_library(EMBEDDED_LIB_STATIC libmysqld.a PATHS ${EMBEDDED_LIB} PATH_SUFFIXES mysql mariadb NO_DEFAULT_PATH)
else()
find_library(EMBEDDED_LIB_STATIC libmysqld.a PATH_SUFFIXES mysql mariadb)
@ -128,16 +132,13 @@ macro(check_dirs)
endif()
set(EMBEDDED_LIB ${EMBEDDED_LIB_STATIC} CACHE FILEPATH "Path to libmysqld" FORCE)
set(CMAKE_FIND_LIBRARY_SUFFIXES ${OLD_SUFFIXES})
unset(OLD_SUFFIXES CACHE)
set(OLD_SUFFIXES "" INTERNAL)
else()
else()
if (DEFINED EMBEDDED_LIB)
if(DEBUG_OUTPUT)
message(STATUS "Searching for libmysqld.so at: ${EMBEDDED_LIB}")
endif()
get_filename_component(EMBEDDED_LIB_PATH ${EMBEDDED_LIB} REALPATH CACHE)
set(EMBEDDED_LIB ${EMBEDDED_LIB_PATH} CACHE PATH "Path to libmysqld" FORCE)
unset(EMBEDDED_LIB_PATH CACHE)
find_library(EMBEDDED_LIB_DYNAMIC mysqld PATHS ${EMBEDDED_LIB} PATH_SUFFIXES mysql mariadb NO_DEFAULT_PATH)
else()
find_library(EMBEDDED_LIB_DYNAMIC mysqld PATH_SUFFIXES mysql mariadb)
@ -148,14 +149,12 @@ macro(check_dirs)
set(EMBEDDED_LIB ${EMBEDDED_LIB_DYNAMIC} CACHE FILEPATH "Path to libmysqld" FORCE)
endif()
unset(EMBEDDED_LIB_DYNAMIC CACHE)
unset(EMBEDDED_LIB_STATIC CACHE)
set(EMBEDDED_LIB_DYNAMIC "" INTERNAL)
set(EMBEDDED_LIB_STATIC "" INTERNAL)
# Inform the user about the embedded library
if(EMBEDDED_LIB MATCHES "NOTFOUND")
message(STATUS "${EMBEDDED_LIB}")
unset(EMBEDDED_LIB CACHE)
if( (${EMBEDDED_LIB} STREQUAL "EMBEDDED_LIB_STATIC-NOTFOUND") OR (${EMBEDDED_LIB} STREQUAL "EMBEDDED_LIB_DYNAMIC-NOTFOUND"))
set(DEPS_OK FALSE CACHE BOOL "If all the dependencies were found.")
message(FATAL_ERROR "Library not found: libmysqld. If your install of MySQL is in a non-default location, please provide the location with -DEMBEDDED_LIB=<path to library>")
else()
get_filename_component(EMBEDDED_LIB ${EMBEDDED_LIB} REALPATH)
@ -168,27 +167,26 @@ macro(check_dirs)
if(${RPM_FNC} MATCHES "RPM_FNC-NOTFOUND")
find_file(DEB_FNC init-functions PATHS /lib/lsb)
if(${DEB_FNC} MATCHES "DEB_FNC-NOTFOUND")
unset(DEB_BASED CACHE)
set(DEPS_OK FALSE CACHE BOOL "If all the dependencies were found.")
message(FATAL_ERROR "Cannot find required init-functions in /lib/lsb/ or /etc/rc.d/init.d/, please confirm that your system files are OK.")
else()
set(DEB_BASED TRUE CACHE BOOL "If init.d script uses /lib/lsb/init-functions instead of /etc/rc.d/init.d/functions." FORCE)
set(DEB_BASED TRUE CACHE BOOL "If init.d script uses /lib/lsb/init-functions instead of /etc/rc.d/init.d/functions.")
endif()
else()
set(DEB_BASED FALSE CACHE BOOL "If init.d script uses /lib/lsb/init-functions instead of /etc/rc.d/init.d/functions." FORCE)
set(DEB_BASED FALSE CACHE BOOL "If init.d script uses /lib/lsb/init-functions instead of /etc/rc.d/init.d/functions.")
endif()
unset(DEB_FNC CACHE)
unset(RPM_FNC CACHE)
set(DEB_FNC "" INTERNAL)
set(RPM_FNC "" INTERNAL)
#Check RabbitMQ headers and libraries
if(BUILD_RABBITMQ)
if(DEFINED RABBITMQ_LIB)
get_filename_component(RABBITMQ_LIB ${RABBITMQ_LIB} DIRECTORY CACHE)
find_library(RMQ_LIB rabbitmq PATHS ${RABBITMQ_LIB} NO_DEFAULT_PATH)
endif()
find_library(RMQ_LIB rabbitmq)
if(RMQ_LIB MATCHES NOTFOUND)
unset(RABBITMQ_LIB)
if(RMQ_LIB STREQUAL "RMQ_LIB-NOTFOUND")
set(DEPS_OK FALSE CACHE BOOL "If all the dependencies were found.")
message(FATAL_ERROR "Cannot find RabbitMQ libraries, please define the path to the libraries with -DRABBITMQ_LIB=<path>")
else()
set(RABBITMQ_LIB ${RMQ_LIB} CACHE PATH "Path to RabbitMQ libraries" FORCE)
@ -196,20 +194,17 @@ macro(check_dirs)
endif()
if(DEFINED RABBITMQ_HEADERS)
get_filename_component(RABBITMQ_HEADERS ${RABBITMQ_HEADERS} DIRECTORY CACHE)
find_file(RMQ_HEADERS amqp.h PATHS ${RABBITMQ_HEADERS} NO_DEFAULT_PATH)
endif()
find_file(RMQ_HEADERS amqp.h)
if(RMQ_HEADERS MATCHES NOTFOUND)
unset(RABBITMQ_HEADERS)
if(RMQ_HEADERS STREQUAL "RMQ_HEADERS-NOTFOUND")
set(DEPS_OK FALSE CACHE BOOL "If all the dependencies were found.")
message(FATAL_ERROR "Cannot find RabbitMQ headers, please define the path to the headers with -DRABBITMQ_HEADERS=<path>")
else()
set(RABBITMQ_HEADERS ${RMQ_HEADERS} CACHE PATH "Path to RabbitMQ headers" FORCE)
message(STATUS "Using RabbitMQ headers found at: ${RABBITMQ_HEADERS}")
endif()
unset(RMQ_HEADERS CACHE)
unset(RMQ_LIB CACHE)
endif()
endmacro()