Commit 7da1887c authored by Vladislav Vaintroub's avatar Vladislav Vaintroub

Avoid mysqld dependency on libaio.so by linking xtradb statically to libaio.

A variable XTRADB_PREFER_STATIC_LIBAIO should be set to 1 (or TRUE
 or ON) for static linking.

Even if mysqld can avoid dependency on shared libaio, shared libraries 
libmysqld.so or ha_innodb.so cannot link without it.

Given that the patch primarily addresses building tar.gz package, and 
shared libraries mentioned above deemed less important than mysqld
executable, we accept shared lib dependency on libaio.so
parent a5359913
......@@ -115,9 +115,9 @@ IF(UNIX)
OPTION(WITH_LIBEDIT "" ON)
ENDIF()
OPTION(WITH_PIC "" ON) # Why?
IF(CMAKE_SYSTEM_NAME STREQUAL "Linux")
IF(NOT IGNORE_AIO_CHECK)
# Ensure aio is available on Linux (required by InnoDB)
CHECK_INCLUDE_FILES(libaio.h HAVE_LIBAIO_H)
......@@ -133,6 +133,14 @@ IF(UNIX)
If you really do not want it, pass -DIGNORE_AIO_CHECK to cmake.
")
ENDIF()
# Remove libaio dependency from mysqld
SET(XTRADB_PREFER_STATIC_LIBAIO 1)
# Unfortunately, linking shared libmysqld with static aio
# does not work, unless we add also dynamic one. This also means
# libmysqld.so will depend on libaio.so
SET(LIBMYSQLD_SO_EXTRA_LIBS aio)
ENDIF()
# Enable fast mutexes on Linux
......
......@@ -157,6 +157,9 @@ IF(NOT DISABLE_SHARED)
# libmysqld
SET_TARGET_PROPERTIES(libmysqld PROPERTIES CLEAN_DIRECT_OUTPUT 1)
SET_TARGET_PROPERTIES(mysqlserver PROPERTIES CLEAN_DIRECT_OUTPUT 1)
IF(LIBMYSQLD_SO_EXTRA_LIBS)
TARGET_LINK_LIBRARIES(libmysqld ${LIBMYSQLD_SO_EXTRA_LIBS})
ENDIF()
ENDIF()
ENDIF()
......@@ -23,12 +23,18 @@ INCLUDE(CheckCSourceRuns)
IF(UNIX)
IF(CMAKE_SYSTEM_NAME STREQUAL "Linux")
CHECK_INCLUDE_FILES (libaio.h HAVE_LIBAIO_H)
CHECK_LIBRARY_EXISTS(aio io_queue_init "" HAVE_LIBAIO)
ADD_DEFINITIONS("-DUNIV_LINUX -D_GNU_SOURCE=1")
IF(HAVE_LIBAIO_H AND HAVE_LIBAIO)
IF (XTRADB_PREFER_STATIC_LIBAIO)
SET(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
ENDIF()
FIND_LIBRARY(AIO_LIBRARY aio)
IF(AIO_LIBRARY)
CHECK_LIBRARY_EXISTS(${AIO_LIBRARY} io_queue_init "" HAVE_LIBAIO)
IF(HAVE_LIBAIO AND HAVE_LIBAIO_H)
ADD_DEFINITIONS(-DLINUX_NATIVE_AIO=1)
LINK_LIBRARIES(aio)
ENDIF()
LINK_LIBRARIES(${AIO_LIBRARY})
ENDIF()
ADD_DEFINITIONS("-DUNIV_LINUX -D_GNU_SOURCE=1")
ELSEIF(CMAKE_SYSTEM_NAME MATCHES "HP*")
ADD_DEFINITIONS("-DUNIV_HPUX -DUNIV_MUST_NOT_INLINE")
ELSEIF(CMAKE_SYSTEM_NAME STREQUAL "AIX")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment