summaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorVladislav Vaintroub <wlad@sun.com>2010-01-26 15:43:53 +0000
committerVladislav Vaintroub <wlad@sun.com>2010-01-26 15:43:53 +0000
commit25d8787a32d0142bf2db869ab97570d730a7ee91 (patch)
treec2a0135741fb12f60329c772b45c76d5c5a80c0c /cmake
parent3a7be724dc056a41642b484f56da0859c96dbd94 (diff)
downloadmariadb-git-25d8787a32d0142bf2db869ab97570d730a7ee91.tar.gz
WL#5161: Following Mats' suggestion, moved Solaris specific workaround to cmake/os/SunOS.cmake
Diffstat (limited to 'cmake')
-rw-r--r--cmake/Makefile.am3
-rw-r--r--cmake/os/SunOS.cmake71
2 files changed, 73 insertions, 1 deletions
diff --git a/cmake/Makefile.am b/cmake/Makefile.am
index 95c88ebd8e2..2e6563cd92c 100644
--- a/cmake/Makefile.am
+++ b/cmake/Makefile.am
@@ -25,4 +25,5 @@ EXTRA_DIST = \
install_layout.cmake \
build_configurations/mysql_release.cmake \
os/Windows.cmake \
- os/Linux.cmake
+ os/Linux.cmake \
+ os/SunOS.cmake
diff --git a/cmake/os/SunOS.cmake b/cmake/os/SunOS.cmake
new file mode 100644
index 00000000000..3d883eeb9c8
--- /dev/null
+++ b/cmake/os/SunOS.cmake
@@ -0,0 +1,71 @@
+# 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)
+