diff options
author | Vladislav Vaintroub <vvaintroub@mysql.com> | 2010-01-26 15:56:50 +0100 |
---|---|---|
committer | Vladislav Vaintroub <vvaintroub@mysql.com> | 2010-01-26 15:56:50 +0100 |
commit | 3a7be724dc056a41642b484f56da0859c96dbd94 (patch) | |
tree | 92fb241d2189e6f4395e0fd84188c222fa01e44d | |
parent | 19a2c052a5ef270ab757e405e5bdb8e2d6129054 (diff) | |
download | mariadb-git-3a7be724dc056a41642b484f56da0859c96dbd94.tar.gz |
WL#5161, implement Mats' suggeston to move platform specifics into own files
under cmake/os. This patch does it for Linux
-rw-r--r-- | cmake/Makefile.am | 3 | ||||
-rw-r--r-- | cmake/os/Linux.cmake | 47 | ||||
-rw-r--r-- | cmake/os/Windows.cmake | 2 | ||||
-rw-r--r-- | configure.cmake | 64 |
4 files changed, 62 insertions, 54 deletions
diff --git a/cmake/Makefile.am b/cmake/Makefile.am index 855af2e982f..95c88ebd8e2 100644 --- a/cmake/Makefile.am +++ b/cmake/Makefile.am @@ -24,4 +24,5 @@ EXTRA_DIST = \ mysql_add_executable.cmake \ install_layout.cmake \ build_configurations/mysql_release.cmake \ - os/Windows.cmake + os/Windows.cmake \ + os/Linux.cmake diff --git a/cmake/os/Linux.cmake b/cmake/os/Linux.cmake new file mode 100644 index 00000000000..946e020d6f4 --- /dev/null +++ b/cmake/os/Linux.cmake @@ -0,0 +1,47 @@ + +# 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 + +# This file includes Linux specific options and quirks, related to system checks + +INCLUDE(CheckSymbolExists) + +# Something that needs to be set on legacy reasons +SET(TARGET_OS_LINUX 1) +SET(HAVE_NPTL 1) +SET(_GNU_SOURCE 1) + +# Fix CMake (< 2.8) flags. -rdynamic exports too many symbols. +FOREACH(LANG C CXX) + STRING(REPLACE "-rdynamic" "" + CMAKE_SHARED_LIBRARY_LINK_${LANG}_FLAGS + ${CMAKE_SHARED_LIBRARY_LINK_${LANG}_FLAGS} + ) +ENDFOREACH() + +# Ensure we have clean build for shared libraries +# without unresolved symbols +SET(LINK_FLAG_NO_UNDEFINED "--Wl,--no-undefined") + +# 64 bit file offset support flag +SET(_FILE_OFFSET_BITS 64) + +# Linux specific HUGETLB /large page support +CHECK_SYMBOL_EXISTS(SHM_HUGETLB sys/shm.h HAVE_DECL_SHM_HUGETLB) +IF(HAVE_DECL_SHM_HUGETLB) + SET(HAVE_LARGE_PAGES 1) + SET(HUGETLB_USE_PROC_MEMINFO 1) + SET(HAVE_LARGE_PAGE_OPTION 1) +ENDIF() diff --git a/cmake/os/Windows.cmake b/cmake/os/Windows.cmake index 8a5ad4359d5..42917d0893d 100644 --- a/cmake/os/Windows.cmake +++ b/cmake/os/Windows.cmake @@ -1,4 +1,4 @@ -# Copyright (C) 2009 Sun Microsystems, Inc +# 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 diff --git a/configure.cmake b/configure.cmake index 2c4f50568f5..7f13a11572d 100644 --- a/configure.cmake +++ b/configure.cmake @@ -44,14 +44,8 @@ IF(UNIX) ENDIF() -# -# Tests for OS -# -IF (CMAKE_SYSTEM_NAME MATCHES "Linux") - SET(TARGET_OS_LINUX 1) - SET(HAVE_NPTL 1) - SET(_GNU_SOURCE 1) -ELSEIF(CMAKE_SYSTEM_NAME MATCHES "SunOS") + +IF(CMAKE_SYSTEM_NAME MATCHES "SunOS") SET(TARGET_OS_SOLARIS 1) ENDIF() @@ -66,6 +60,8 @@ ENDIF() IF(CMAKE_COMPILER_IS_GNUCXX) + # MySQL "canonical" GCC flags. At least -fno-rtti flag affects + # ABI and cannot be simply removed. SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-implicit-templates -fno-exceptions -fno-rtti") IF(CMAKE_CXX_FLAGS) @@ -75,6 +71,12 @@ IF(CMAKE_COMPILER_IS_GNUCXX) SET(HAVE_EXPLICIT_TEMPLATE_INSTANTIATION TRUE) ENDIF() ENDIF() + + IF (CMAKE_EXE_LINKER_FLAGS MATCHES " -static " + OR CMAKE_EXE_LINKER_FLAGS MATCHES " -static$") + SET(HAVE_DLOPEN FALSE CACHE "Disable dlopen due to -static flag" FORCE) + SET(WITHOUT_DYNAMIC_PLUGINS TRUE) + ENDIF() IF(APPLE AND CMAKE_OSX_DEPLOYMENT_TARGET) # Workaround linker problems on OSX 10.4 IF(CMAKE_OSX_DEPLOYMENT_TARGET VERSION_LESS "10.5") @@ -90,7 +92,7 @@ IF(CMAKE_SYSTEM_NAME STREQUAL "HP-UX") SET(_LARGEFILE64_SOURCE 1) SET(_FILE_OFFSET_BITS 64) ENDIF() -IF(CMAKE_SYSTEM_NAME STREQUAL "Linux" OR CMAKE_SYSTEM_NAME STREQUAL "SunOS" ) +IF(CMAKE_SYSTEM_NAME STREQUAL "SunOS" ) SET(_FILE_OFFSET_BITS 64) ENDIF() IF(CMAKE_SYSTEM_NAME MATCHES "AIX" OR CMAKE_SYSTEM_NAME MATCHES "OS400") @@ -98,22 +100,6 @@ IF(CMAKE_SYSTEM_NAME MATCHES "AIX" OR CMAKE_SYSTEM_NAME MATCHES "OS400") ENDIF() -IF(CMAKE_GENERATOR MATCHES "Visual Studio 7") - # VS2003 has a bug that prevents linking mysqld with module definition file - # (/DEF option for linker). Linker would incorrectly complain about multiply - # defined symbols. Workaround is to disable dynamic plugins, so /DEF is not - # used. - MESSAGE( - "Warning: Building MySQL with Visual Studio 2003.NET is no more supported.") - MESSAGE("Please use a newer version of Visual Studio.") - SET(WITHOUT_DYNAMIC_PLUGINS TRUE) - - # VS2003 needs the /Op compiler option to disable floating point - # optimizations - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Op") - SET(CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS} /Op") -ENDIF() - IF(CMAKE_SYSTEM_NAME STREQUAL "HP-UX" ) IF(CMAKE_SIZEOF_VOID_P EQUAL 4) @@ -129,18 +115,6 @@ IF(CMAKE_SYSTEM_NAME STREQUAL "HP-UX" ) ENDIF() ENDIF() -# Ensure we have clean build for shared libraries -# without extra dependencies and without unresolved symbols -# (on system that support it) -IF(CMAKE_SYSTEM_NAME STREQUAL "Linux") - FOREACH(LANG C CXX) - STRING(REPLACE "-rdynamic" "" - CMAKE_SHARED_LIBRARY_LINK_${LANG}_FLAGS - ${CMAKE_SHARED_LIBRARY_LINK_${LANG}_FLAGS} - ) - ENDFOREACH() - SET(LINK_FLAG_NO_UNDEFINED "--Wl,--no-undefined") -ENDIF() #Some OS specific hacks IF(CMAKE_SYSTEM_NAME MATCHES "FreeBSD") @@ -389,13 +363,6 @@ CHECK_FUNCTION_EXISTS_UNIX (compress HAVE_COMPRESS) CHECK_FUNCTION_EXISTS_UNIX (crypt HAVE_CRYPT) CHECK_FUNCTION_EXISTS_UNIX (dlerror HAVE_DLERROR) CHECK_FUNCTION_EXISTS_UNIX (dlopen HAVE_DLOPEN) -IF (CMAKE_COMPILER_IS_GNUCC) - IF (CMAKE_EXE_LINKER_FLAGS MATCHES " -static " - OR CMAKE_EXE_LINKER_FLAGS MATCHES " -static$") - SET(HAVE_DLOPEN FALSE CACHE "Disable dlopen due to -static flag" FORCE) - SET(WITHOUT_DYNAMIC_PLUGINS TRUE) - ENDIF() -ENDIF() CHECK_FUNCTION_EXISTS_UNIX (fchmod HAVE_FCHMOD) CHECK_FUNCTION_EXISTS_UNIX (fcntl HAVE_FCNTL) CHECK_FUNCTION_EXISTS_UNIX (fconvert HAVE_FCONVERT) @@ -1005,14 +972,7 @@ CHECK_CXX_SOURCE_COMPILES_UNIX(" }" HAVE_GETHOSTBYNAME_R_RETURN_INT) -IF(CMAKE_SYSTEM_NAME STREQUAL "Linux") - CHECK_SYMBOL_EXISTS(SHM_HUGETLB sys/shm.h HAVE_DECL_SHM_HUGETLB) - IF(HAVE_DECL_SHM_HUGETLB) - SET(HAVE_LARGE_PAGES 1) - SET(HUGETLB_USE_PROC_MEMINFO 1) - SET(HAVE_LARGE_PAGE_OPTION 1) - ENDIF() -ENDIF() + IF(CMAKE_SYSTEM_NAME STREQUAL "SunOS") CHECK_SYMBOL_EXISTS(MHA_MAPSIZE_VA sys/mman.h HAVE_DECL_MHA_MAPSIZE_VA) |