~ubuntu-branches/ubuntu/trusty/mariadb-5.5/trusty-proposed

« back to all changes in this revision

Viewing changes to cmake/os/SunOS.cmake

  • Committer: Package Import Robot
  • Author(s): Otto Kekäläinen
  • Date: 2013-12-22 10:27:05 UTC
  • Revision ID: package-import@ubuntu.com-20131222102705-mndw7s12mz0szrcn
Tags: upstream-5.5.32
Import upstream version 5.5.32

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
 
2
 
3
# This program is free software; you can redistribute it and/or modify
 
4
# it under the terms of the GNU General Public License as published by
 
5
# the Free Software Foundation; version 2 of the License.
 
6
#
 
7
# This program is distributed in the hope that it will be useful,
 
8
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
9
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
10
# GNU General Public License for more details.
 
11
#
 
12
# You should have received a copy of the GNU General Public License
 
13
# along with this program; if not, write to the Free Software
 
14
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA 
 
15
 
 
16
INCLUDE(CheckSymbolExists)
 
17
INCLUDE(CheckCSourceRuns)
 
18
INCLUDE(CheckCSourceCompiles) 
 
19
 
 
20
# Enable 64 bit file offsets
 
21
SET(_FILE_OFFSET_BITS 64)
 
22
 
 
23
# Legacy option, without it  my_pthread is having problems
 
24
ADD_DEFINITIONS(-DHAVE_RWLOCK_T)
 
25
 
 
26
# On  Solaris, use of intrinsics will screw the lib search logic
 
27
# Force using -lm, so rint etc are found.
 
28
SET(LIBM m)
 
29
 
 
30
# CMake defined -lthread as thread flag. This crashes in dlopen 
 
31
# when trying to load plugins workaround with -lpthread
 
32
SET(CMAKE_THREADS_LIBS_INIT -lpthread CACHE INTERNAL "" FORCE)
 
33
 
 
34
# Solaris specific large page support
 
35
CHECK_SYMBOL_EXISTS(MHA_MAPSIZE_VA sys/mman.h  HAVE_DECL_MHA_MAPSIZE_VA)
 
36
IF(HAVE_DECL_MHA_MAPSIZE_VA)
 
37
 SET(HAVE_SOLARIS_LARGE_PAGES 1)
 
38
 SET(HAVE_LARGE_PAGE_OPTION 1)
 
39
ENDIF()
 
40
 
 
41
 
 
42
# Solaris atomics
 
43
CHECK_C_SOURCE_RUNS(
 
44
 "
 
45
 #include  <atomic.h>
 
46
  int main()
 
47
  {
 
48
    int foo = -10; int bar = 10;
 
49
    int64_t foo64 = -10; int64_t bar64 = 10;
 
50
    if (atomic_add_int_nv((uint_t *)&foo, bar) || foo)
 
51
      return -1;
 
52
    bar = atomic_swap_uint((uint_t *)&foo, (uint_t)bar);
 
53
    if (bar || foo != 10)
 
54
     return -1;
 
55
    bar = atomic_cas_uint((uint_t *)&bar, (uint_t)foo, 15);
 
56
    if (bar)
 
57
      return -1;
 
58
    if (atomic_add_64_nv((volatile uint64_t *)&foo64, bar64) || foo64)
 
59
      return -1;
 
60
    bar64 = atomic_swap_64((volatile uint64_t *)&foo64, (uint64_t)bar64);
 
61
    if (bar64 || foo64 != 10)
 
62
      return -1;
 
63
    bar64 = atomic_cas_64((volatile uint64_t *)&bar64, (uint_t)foo64, 15);
 
64
    if (bar64)
 
65
      return -1;
 
66
    atomic_or_64((volatile uint64_t *)&bar64, 0);
 
67
    return 0;
 
68
  }
 
69
"  HAVE_SOLARIS_ATOMIC)
 
70
 
 
71
 
 
72
# Check is special processor flag needs to be set on older GCC
 
73
#that defaults to v8 sparc . Code here is taken from my_rdtsc.c 
 
74
IF(CMAKE_COMPILER_IS_GNUCC AND CMAKE_SIZEOF_VOID_P EQUAL 4
 
75
  AND CMAKE_SYSTEM_PROCESSOR MATCHES "sparc")
 
76
  SET(SOURCE
 
77
  "
 
78
  int main()
 
79
  {
 
80
     long high\;
 
81
     long low\;
 
82
    __asm __volatile__ (\"rd %%tick,%1\; srlx %1,32,%0\" : \"=r\" ( high), \"=r\" (low))\;
 
83
    return 0\;
 
84
  } ")
 
85
  CHECK_C_SOURCE_COMPILES(${SOURCE}  HAVE_SPARC32_TICK)
 
86
  IF(NOT HAVE_SPARC32_TICK)
 
87
    SET(CMAKE_REQUIRED_FLAGS "-mcpu=v9")
 
88
    CHECK_C_SOURCE_COMPILES(${SOURCE}  HAVE_SPARC32_TICK_WITH_V9)
 
89
    SET(CMAKE_REQUIRED_FLAGS)
 
90
    IF(HAVE_SPARC32_TICK_WITH_V9)
 
91
      SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mcpu=v9")
 
92
      SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mcpu=v9")
 
93
    ENDIF()
 
94
  ENDIF()
 
95
ENDIF()
 
96
 
 
97
IF(CMAKE_CXX_COMPILER_ID MATCHES "SunPro")
 
98
  # Unnamed structs and unions
 
99
  SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -features=extensions")
 
100
ENDIF()