Commit b6d72ed4 authored by wlad's avatar wlad

MDEV-14283 : Fix Solaris 10 build.

- introduce system check for posix_memalign (not available on Solaris 10)
- Disable dtrace probes, to fix weird link errors in mariabackup
parent 7c4f8593
......@@ -43,6 +43,7 @@ MACRO(CHECK_DTRACE)
IF(DTRACE AND NOT CMAKE_SYSTEM_NAME MATCHES "FreeBSD"
AND NOT BUGGY_GCC_NO_DTRACE_MODULES
AND NOT BUGGY_LINUX_DTRACE)
AND NOT SYSTEM_NAME MATCHES "SunOS")
SET(ENABLE_DTRACE ON CACHE BOOL "Enable dtrace")
ENDIF()
SET(HAVE_DTRACE ${ENABLE_DTRACE})
......
......@@ -85,6 +85,12 @@ SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DUNIV_DEBUG -DUNIV_SYNC_DEB
CHECK_FUNCTION_EXISTS(sched_getcpu HAVE_SCHED_GETCPU)
IF(NOT MSVC)
CHECK_FUNCTION_EXISTS(posix_memalign HAVE_POSIX_MEMALIGN)
IF(HAVE_POSIX_MEMALIGN)
ADD_DEFINITIONS(-DHAVE_POSIX_MEMALIGN)
ENDIF()
# either define HAVE_IB_GCC_ATOMIC_BUILTINS or not
# workaround for old gcc on x86, gcc atomic ops only work under -march=i686
IF(CMAKE_SYSTEM_PROCESSOR STREQUAL "i686" AND CMAKE_COMPILER_IS_GNUCC AND
......
......@@ -86,10 +86,13 @@ inline void* aligned_malloc(size_t size, size_t align) {
void *result;
#ifdef _MSC_VER
result = _aligned_malloc(size, align);
#else
#elif defined (HAVE_POSIX_MEMALIGN)
if(posix_memalign(&result, align, size)) {
result = 0;
}
#else
/* Use unaligned malloc as fallback */
result = malloc(size);
#endif
return result;
}
......
......@@ -93,6 +93,12 @@ SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DUNIV_DEBUG -DUNIV_SYNC_DEB
CHECK_FUNCTION_EXISTS(sched_getcpu HAVE_SCHED_GETCPU)
IF(NOT MSVC)
CHECK_FUNCTION_EXISTS(posix_memalign HAVE_POSIX_MEMALIGN)
IF(HAVE_POSIX_MEMALIGN)
ADD_DEFINITIONS(-DHAVE_POSIX_MEMALIGN)
ENDIF()
# either define HAVE_IB_GCC_ATOMIC_BUILTINS or not
# workaround for old gcc on x86, gcc atomic ops only work under -march=i686
IF(CMAKE_SYSTEM_PROCESSOR STREQUAL "i686" AND CMAKE_COMPILER_IS_GNUCC AND
......
......@@ -102,10 +102,13 @@ inline void* aligned_malloc(size_t size, size_t align) {
void *result;
#ifdef _MSC_VER
result = _aligned_malloc(size, align);
#else
#elif defined (HAVE_POSIX_MEMALIGN)
if(posix_memalign(&result, align, size)) {
result = 0;
}
#else
/* Use unaligned malloc as fallback */
result = malloc(size);
#endif
return result;
}
......
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