diff options
Diffstat (limited to 'configure.cmake')
-rw-r--r-- | configure.cmake | 135 |
1 files changed, 44 insertions, 91 deletions
diff --git a/configure.cmake b/configure.cmake index dec28f47d72..a9aa1778ba8 100644 --- a/configure.cmake +++ b/configure.cmake @@ -52,7 +52,7 @@ IF(NOT SYSTEM_TYPE) ENDIF() ENDIF() -IF(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang") +IF(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang" AND (NOT MSVC)) # MySQL "canonical" GCC flags. At least -fno-rtti flag affects # ABI and cannot be simply removed. SET(CMAKE_CXX_FLAGS @@ -65,6 +65,15 @@ IF(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang") ENDIF() ENDIF() +# 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 + CMAKE_C_COMPILER_VERSION VERSION_LESS "4.4.0") + SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=i686") + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=i686") + # query_response_time.cc causes "error: unable to find a register to spill" + SET(PLUGIN_QUERY_RESPONSE_TIME NO CACHE BOOL "Disabled, gcc is too old") +ENDIF() + IF(WITHOUT_DYNAMIC_PLUGINS) MESSAGE("Dynamic plugins are disabled.") ENDIF(WITHOUT_DYNAMIC_PLUGINS) @@ -361,6 +370,7 @@ CHECK_FUNCTION_EXISTS (mallinfo HAVE_MALLINFO) CHECK_FUNCTION_EXISTS (memcpy HAVE_MEMCPY) CHECK_FUNCTION_EXISTS (memmove HAVE_MEMMOVE) CHECK_FUNCTION_EXISTS (mkstemp HAVE_MKSTEMP) +CHECK_FUNCTION_EXISTS (mkostemp HAVE_MKOSTEMP) CHECK_FUNCTION_EXISTS (mlock HAVE_MLOCK) CHECK_FUNCTION_EXISTS (mlockall HAVE_MLOCKALL) CHECK_FUNCTION_EXISTS (mmap HAVE_MMAP) @@ -405,7 +415,6 @@ CHECK_FUNCTION_EXISTS (strtoul HAVE_STRTOUL) CHECK_FUNCTION_EXISTS (strtoull HAVE_STRTOULL) CHECK_FUNCTION_EXISTS (strcasecmp HAVE_STRCASECMP) CHECK_FUNCTION_EXISTS (tell HAVE_TELL) -CHECK_FUNCTION_EXISTS (tempnam HAVE_TEMPNAM) CHECK_FUNCTION_EXISTS (thr_setconcurrency HAVE_THR_SETCONCURRENCY) CHECK_FUNCTION_EXISTS (thr_yield HAVE_THR_YIELD) CHECK_FUNCTION_EXISTS (vasprintf HAVE_VASPRINTF) @@ -469,17 +478,8 @@ CHECK_SYMBOL_EXISTS(TIOCSTAT "sys/ioctl.h" TIOCSTAT_IN_SYS_IOCTL) CHECK_SYMBOL_EXISTS(FIONREAD "sys/filio.h" FIONREAD_IN_SYS_FILIO) CHECK_SYMBOL_EXISTS(gettimeofday "sys/time.h" HAVE_GETTIMEOFDAY) -CHECK_SYMBOL_EXISTS(finite "math.h" HAVE_FINITE_IN_MATH_H) -IF(HAVE_FINITE_IN_MATH_H) - SET(HAVE_FINITE TRUE CACHE INTERNAL "") -ELSE() - CHECK_SYMBOL_EXISTS(finite "ieeefp.h" HAVE_FINITE) -ENDIF() -CHECK_SYMBOL_EXISTS(log2 math.h HAVE_LOG2) -CHECK_SYMBOL_EXISTS(rint math.h HAVE_RINT) - # -# Test for endianess +# Test for endianness # INCLUDE(TestBigEndian) IF(APPLE) @@ -759,43 +759,6 @@ IF(NOT C_HAS_inline) ENDIF() ENDIF() -IF(NOT CMAKE_CROSSCOMPILING AND NOT MSVC) - STRING(TOLOWER ${CMAKE_SYSTEM_PROCESSOR} processor) - IF(processor MATCHES "86" OR processor MATCHES "amd64" OR processor MATCHES "x64") - #Check for x86 PAUSE instruction - # We have to actually try running the test program, because of a bug - # in Solaris on x86_64, where it wrongly reports that PAUSE is not - # supported when trying to run an application. See - # http://bugs.opensolaris.org/bugdatabase/printableBug.do?bug_id=6478684 - CHECK_C_SOURCE_RUNS(" - int main() - { - __asm__ __volatile__ (\"pause\"); - return 0; - }" HAVE_PAUSE_INSTRUCTION) - ENDIF() - IF (NOT HAVE_PAUSE_INSTRUCTION) - CHECK_C_SOURCE_COMPILES(" - int main() - { - __asm__ __volatile__ (\"rep; nop\"); - return 0; - } - " HAVE_FAKE_PAUSE_INSTRUCTION) - ENDIF() - IF (NOT HAVE_PAUSE_INSTRUCTION) - CHECK_C_SOURCE_COMPILES(" - #include <sys/platform/ppc.h> - int main() - { - __ppc_set_ppr_low(); - __ppc_set_ppr_med(); - return 0; - } - " HAVE_HMT_PRIORITY_INSTRUCTION) - ENDIF() -ENDIF() - CHECK_SYMBOL_EXISTS(tcgetattr "termios.h" HAVE_TCGETATTR 1) # @@ -907,48 +870,38 @@ SET(SIGNAL_WITH_VIO_CLOSE 1) MARK_AS_ADVANCED(NO_ALARM) -IF(WITH_ATOMIC_OPS STREQUAL "up") - SET(MY_ATOMIC_MODE_DUMMY 1 CACHE BOOL "Assume single-CPU mode, no concurrency") -ELSEIF(WITH_ATOMIC_OPS STREQUAL "smp") -ELSEIF(NOT WITH_ATOMIC_OPS) - CHECK_CXX_SOURCE_COMPILES(" - int main() - { - int foo= -10; int bar= 10; - long long int foo64= -10; long long int bar64= 10; - if (!__sync_fetch_and_add(&foo, bar) || foo) - return -1; - bar= __sync_lock_test_and_set(&foo, bar); - if (bar || foo != 10) - return -1; - bar= __sync_val_compare_and_swap(&bar, foo, 15); - if (bar) - return -1; - if (!__sync_fetch_and_add(&foo64, bar64) || foo64) - return -1; - bar64= __sync_lock_test_and_set(&foo64, bar64); - if (bar64 || foo64 != 10) - return -1; - bar64= __sync_val_compare_and_swap(&bar64, foo, 15); - if (bar64) - return -1; - return 0; - }" - HAVE_GCC_ATOMIC_BUILTINS) - CHECK_CXX_SOURCE_COMPILES(" - int main() - { - long long int var= 1; - long long int *ptr= &var; - return (int)__atomic_load_n(ptr, __ATOMIC_SEQ_CST); - }" - HAVE_GCC_C11_ATOMICS) -ELSE() - MESSAGE(FATAL_ERROR "${WITH_ATOMIC_OPS} is not a valid value for WITH_ATOMIC_OPS!") -ENDIF() - -SET(WITH_ATOMIC_OPS "${WITH_ATOMIC_OPS}" CACHE STRING "Implement atomic operations using atomic CPU instructions for multi-processor (smp) or uniprocessor (up) configuration. By default gcc built-in sync functions are used, if available and 'smp' configuration otherwise.") -MARK_AS_ADVANCED(WITH_ATOMIC_OPS MY_ATOMIC_MODE_DUMMY) +CHECK_CXX_SOURCE_COMPILES(" +int main() +{ + int foo= -10; int bar= 10; + long long int foo64= -10; long long int bar64= 10; + if (!__sync_fetch_and_add(&foo, bar) || foo) + return -1; + bar= __sync_lock_test_and_set(&foo, bar); + if (bar || foo != 10) + return -1; + bar= __sync_val_compare_and_swap(&bar, foo, 15); + if (bar) + return -1; + if (!__sync_fetch_and_add(&foo64, bar64) || foo64) + return -1; + bar64= __sync_lock_test_and_set(&foo64, bar64); + if (bar64 || foo64 != 10) + return -1; + bar64= __sync_val_compare_and_swap(&bar64, foo, 15); + if (bar64) + return -1; + return 0; +}" +HAVE_GCC_ATOMIC_BUILTINS) +CHECK_CXX_SOURCE_COMPILES(" +int main() +{ + long long int var= 1; + long long int *ptr= &var; + return (int)__atomic_load_n(ptr, __ATOMIC_SEQ_CST); +}" +HAVE_GCC_C11_ATOMICS) IF(WITH_VALGRIND) SET(HAVE_valgrind 1) |