summaryrefslogtreecommitdiff
path: root/cmake/numa.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'cmake/numa.cmake')
-rw-r--r--cmake/numa.cmake27
1 files changed, 18 insertions, 9 deletions
diff --git a/cmake/numa.cmake b/cmake/numa.cmake
index 4bace0ee7f4..d24318634c3 100644
--- a/cmake/numa.cmake
+++ b/cmake/numa.cmake
@@ -1,16 +1,18 @@
MACRO (MYSQL_CHECK_NUMA)
- IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
+ STRING(TOLOWER "${WITH_NUMA}" WITH_NUMA_LOWERCASE)
+
+ IF(NOT WITH_NUMA)
+ MESSAGE_ONCE(numa "WITH_NUMA=OFF: NUMA memory allocation policy disabled")
+
+ ELSEIF(NOT WITH_NUMA_LOWERCASE STREQUAL "auto" AND NOT WITH_NUMA_LOWERCASE STREQUAL "on")
+ MESSAGE(FATAL_ERROR "Wrong value for WITH_NUMA")
+
+ ELSEIF(CMAKE_SYSTEM_NAME MATCHES "Linux")
CHECK_INCLUDE_FILES(numa.h HAVE_NUMA_H)
CHECK_INCLUDE_FILES(numaif.h HAVE_NUMAIF_H)
IF(HAVE_NUMA_H AND HAVE_NUMAIF_H)
- OPTION(WITH_NUMA "Explicitly set NUMA memory allocation policy" ON)
- ELSE()
- OPTION(WITH_NUMA "Explicitly set NUMA memory allocation policy" OFF)
- ENDIF()
-
- IF(WITH_NUMA AND HAVE_NUMA_H AND HAVE_NUMAIF_H)
SET(SAVE_CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})
SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} numa)
CHECK_C_SOURCE_COMPILES(
@@ -31,12 +33,19 @@ MACRO (MYSQL_CHECK_NUMA)
ENDIF()
ENDIF()
- IF(WITH_NUMA AND NOT HAVE_LIBNUMA)
+ IF(WITH_NUMA_LOWERCASE STREQUAL "auto" AND HAVE_LIBNUMA)
+ MESSAGE_ONCE(numa "WITH_NUMA=AUTO: NUMA memory allocation policy enabled")
+ ELSEIF(WITH_NUMA_LOWERCASE STREQUAL "auto" AND NOT HAVE_LIBNUMA)
+ MESSAGE_ONCE(numa "WITH_NUMA=AUTO: NUMA memory allocation policy disabled")
+ ELSEIF(HAVE_LIBNUMA)
+ MESSAGE_ONCE(numa "WITH_NUMA=ON: NUMA memory allocation policy enabled")
+ ELSE()
# Forget it in cache, abort the build.
UNSET(WITH_NUMA CACHE)
UNSET(NUMA_LIBRARY CACHE)
- MESSAGE(FATAL_ERROR "Could not find numa headers/libraries")
+ MESSAGE(FATAL_ERROR "WITH_NUMA=ON: Could not find NUMA headers/libraries")
ENDIF()
+
ENDIF()
ENDMACRO()