Commit 62bc68a0 authored by Vladislav Vaintroub's avatar Vladislav Vaintroub

WL#5161: Following Mats' suggestion, moved Solaris specific workaround to cmake/os/SunOS.cmake

cmake/os/SunOS.cmake:
  WL#5161: Moved Solaris specific  workaround to cmake/os/SunOS.cmake
parent 7ce02039
...@@ -25,4 +25,5 @@ EXTRA_DIST = \ ...@@ -25,4 +25,5 @@ EXTRA_DIST = \
install_layout.cmake \ install_layout.cmake \
build_configurations/mysql_release.cmake \ build_configurations/mysql_release.cmake \
os/Windows.cmake \ os/Windows.cmake \
os/Linux.cmake os/Linux.cmake \
os/SunOS.cmake
# Copyright (C) 2010 Sun Microsystems, Inc
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
INCLUDE(CheckSymbolExists)
INCLUDE(CheckCSourceRuns)
SET(TARGET_OS_SOLARIS 1)
# Enable 64 bit file offsets
SET(_FILE_OFFSET_BITS 64)
# Legacy option, without it my_pthread is having problems
ADD_DEFINITIONS(-DHAVE_RWLOCK_T)
# On Solaris, use of intrinsics will screw the lib search logic
# Force using -lm, so rint etc are found.
SET(LIBM m)
# CMake defined -lthread as thread flag. This crashes in dlopen
# when trying to load plugins workaround with -lpthread
SET(CMAKE_THREADS_LIBS_INIT -lpthread CACHE INTERNAL "")
# Solaris specific large page support
CHECK_SYMBOL_EXISTS(MHA_MAPSIZE_VA sys/mman.h HAVE_DECL_MHA_MAPSIZE_VA)
IF(HAVE_DECL_MHA_MAPSIZE_VA)
SET(HAVE_SOLARIS_LARGE_PAGES 1)
SET(HAVE_LARGE_PAGE_OPTION 1)
ENDIF()
# Solaris atomics
CHECK_C_SOURCE_RUNS(
"
#include <atomic.h>
int main()
{
int foo = -10; int bar = 10;
int64_t foo64 = -10; int64_t bar64 = 10;
if (atomic_add_int_nv((uint_t *)&foo, bar) || foo)
return -1;
bar = atomic_swap_uint((uint_t *)&foo, (uint_t)bar);
if (bar || foo != 10)
return -1;
bar = atomic_cas_uint((uint_t *)&bar, (uint_t)foo, 15);
if (bar)
return -1;
if (atomic_add_64_nv((volatile uint64_t *)&foo64, bar64) || foo64)
return -1;
bar64 = atomic_swap_64((volatile uint64_t *)&foo64, (uint64_t)bar64);
if (bar64 || foo64 != 10)
return -1;
bar64 = atomic_cas_64((volatile uint64_t *)&bar64, (uint_t)foo64, 15);
if (bar64)
return -1;
atomic_or_64((volatile uint64_t *)&bar64, 0);
return 0;
}
" HAVE_SOLARIS_ATOMIC)
...@@ -45,10 +45,6 @@ ENDIF() ...@@ -45,10 +45,6 @@ ENDIF()
IF(CMAKE_SYSTEM_NAME MATCHES "SunOS")
SET(TARGET_OS_SOLARIS 1)
ENDIF()
# System type affects version_compile_os variable # System type affects version_compile_os variable
IF(NOT SYSTEM_TYPE) IF(NOT SYSTEM_TYPE)
IF(PLATFORM) IF(PLATFORM)
...@@ -92,9 +88,6 @@ IF(CMAKE_SYSTEM_NAME STREQUAL "HP-UX") ...@@ -92,9 +88,6 @@ IF(CMAKE_SYSTEM_NAME STREQUAL "HP-UX")
SET(_LARGEFILE64_SOURCE 1) SET(_LARGEFILE64_SOURCE 1)
SET(_FILE_OFFSET_BITS 64) SET(_FILE_OFFSET_BITS 64)
ENDIF() ENDIF()
IF(CMAKE_SYSTEM_NAME STREQUAL "SunOS" )
SET(_FILE_OFFSET_BITS 64)
ENDIF()
IF(CMAKE_SYSTEM_NAME MATCHES "AIX" OR CMAKE_SYSTEM_NAME MATCHES "OS400") IF(CMAKE_SYSTEM_NAME MATCHES "AIX" OR CMAKE_SYSTEM_NAME MATCHES "OS400")
SET(_LARGE_FILES 1) SET(_LARGE_FILES 1)
ENDIF() ENDIF()
...@@ -123,10 +116,6 @@ ELSEIF(CMAKE_SYSTEM MATCHES "HP-UX" AND CMAKE_SYSTEM MATCHES "11") ...@@ -123,10 +116,6 @@ ELSEIF(CMAKE_SYSTEM MATCHES "HP-UX" AND CMAKE_SYSTEM MATCHES "11")
ADD_DEFINITIONS(-DHPUX11) ADD_DEFINITIONS(-DHPUX11)
ENDIF() ENDIF()
IF(CMAKE_SYSTEM_NAME MATCHES "SunOS")
ADD_DEFINITIONS(-DHAVE_RWLOCK_T)
ENDIF()
# Figure out what engines to build and how (statically or dynamically), # Figure out what engines to build and how (statically or dynamically),
# add preprocessor defines for storage engines. # add preprocessor defines for storage engines.
...@@ -139,6 +128,10 @@ ENDIF(WITHOUT_DYNAMIC_PLUGINS) ...@@ -139,6 +128,10 @@ ENDIF(WITHOUT_DYNAMIC_PLUGINS)
# if function is found, sets output parameter result to the name of the library # if function is found, sets output parameter result to the name of the library
# if function is found in libc, result will be empty # if function is found in libc, result will be empty
FUNCTION(MY_SEARCH_LIBS func libs result) FUNCTION(MY_SEARCH_LIBS func libs result)
IF(${${result}})
# Library is already found or was predefined
RETURN()
ENDIF()
CHECK_FUNCTION_EXISTS(${func} HAVE_${func}_IN_LIBC) CHECK_FUNCTION_EXISTS(${func} HAVE_${func}_IN_LIBC)
IF(HAVE_${func}_IN_LIBC) IF(HAVE_${func}_IN_LIBC)
SET(${result} "" PARENT_SCOPE) SET(${result} "" PARENT_SCOPE)
...@@ -158,13 +151,6 @@ IF(UNIX) ...@@ -158,13 +151,6 @@ IF(UNIX)
IF(NOT LIBM) IF(NOT LIBM)
MY_SEARCH_LIBS(__infinity m LIBM) MY_SEARCH_LIBS(__infinity m LIBM)
ENDIF() ENDIF()
IF(CMAKE_SYSTEM_NAME MATCHES "SunOS")
# On Solaris, use of intrinsics will screw the lib search logic
# Force using -lm, so rint etc are found.
SET(LIBM m)
ENDIF()
MY_SEARCH_LIBS(gethostbyname_r "nsl_r;nsl" LIBNSL) MY_SEARCH_LIBS(gethostbyname_r "nsl_r;nsl" LIBNSL)
MY_SEARCH_LIBS(bind "bind;socket" LIBBIND) MY_SEARCH_LIBS(bind "bind;socket" LIBBIND)
MY_SEARCH_LIBS(crypt crypt LIBCRYPT) MY_SEARCH_LIBS(crypt crypt LIBCRYPT)
...@@ -176,13 +162,6 @@ IF(UNIX) ...@@ -176,13 +162,6 @@ IF(UNIX)
ENDIF() ENDIF()
FIND_PACKAGE(Threads) FIND_PACKAGE(Threads)
IF(CMAKE_SYSTEM_NAME MATCHES "SunOS")
# CMake defined -lthread as thread flag
# This crashes in dlopen when trying to load plugins
# Workaround with -lpthread
SET(CMAKE_THREADS_LIBS_INIT -lpthread)
ENDIF()
SET(CMAKE_REQUIRED_LIBRARIES SET(CMAKE_REQUIRED_LIBRARIES
${LIBM} ${LIBNSL} ${LIBBIND} ${LIBCRYPT} ${LIBSOCKET} ${LIBDL} ${CMAKE_THREAD_LIBS_INIT} ${LIBRT}) ${LIBM} ${LIBNSL} ${LIBBIND} ${LIBCRYPT} ${LIBSOCKET} ${LIBDL} ${CMAKE_THREAD_LIBS_INIT} ${LIBRT})
...@@ -973,15 +952,6 @@ CHECK_CXX_SOURCE_COMPILES_UNIX(" ...@@ -973,15 +952,6 @@ CHECK_CXX_SOURCE_COMPILES_UNIX("
HAVE_GETHOSTBYNAME_R_RETURN_INT) HAVE_GETHOSTBYNAME_R_RETURN_INT)
IF(CMAKE_SYSTEM_NAME STREQUAL "SunOS")
CHECK_SYMBOL_EXISTS(MHA_MAPSIZE_VA sys/mman.h HAVE_DECL_MHA_MAPSIZE_VA)
IF(HAVE_DECL_MHA_MAPSIZE_VA)
SET(HAVE_SOLARIS_LARGE_PAGES 1)
SET(HAVE_LARGE_PAGE_OPTION 1)
ENDIF()
ENDIF()
# Use of ALARMs to wakeup on timeout on sockets # Use of ALARMs to wakeup on timeout on sockets
# #
# This feature makes use of a mutex and is a scalability hog we # This feature makes use of a mutex and is a scalability hog we
...@@ -1086,36 +1056,6 @@ configuration. By default gcc built-in sync functions are used, ...@@ -1086,36 +1056,6 @@ configuration. By default gcc built-in sync functions are used,
if available and 'smp' configuration otherwise.") if available and 'smp' configuration otherwise.")
MARK_AS_ADVANCED(WITH_ATOMIC_LOCKS MY_ATOMIC_MODE_RWLOCK MY_ATOMIC_MODE_DUMMY) MARK_AS_ADVANCED(WITH_ATOMIC_LOCKS MY_ATOMIC_MODE_RWLOCK MY_ATOMIC_MODE_DUMMY)
IF(CMAKE_SYSTEM_NAME STREQUAL "SunOS")
CHECK_C_SOURCE_RUNS(
"
#include <atomic.h>
int main()
{
int foo = -10; int bar = 10;
int64_t foo64 = -10; int64_t bar64 = 10;
if (atomic_add_int_nv((uint_t *)&foo, bar) || foo)
return -1;
bar = atomic_swap_uint((uint_t *)&foo, (uint_t)bar);
if (bar || foo != 10)
return -1;
bar = atomic_cas_uint((uint_t *)&bar, (uint_t)foo, 15);
if (bar)
return -1;
if (atomic_add_64_nv((volatile uint64_t *)&foo64, bar64) || foo64)
return -1;
bar64 = atomic_swap_64((volatile uint64_t *)&foo64, (uint64_t)bar64);
if (bar64 || foo64 != 10)
return -1;
bar64 = atomic_cas_64((volatile uint64_t *)&bar64, (uint_t)foo64, 15);
if (bar64)
return -1;
atomic_or_64((volatile uint64_t *)&bar64, 0);
return 0;
}
" HAVE_SOLARIS_ATOMIC)
ENDIF()
#-------------------------------------------------------------------- #--------------------------------------------------------------------
# Check for IPv6 support # Check for IPv6 support
#-------------------------------------------------------------------- #--------------------------------------------------------------------
......
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