[PATCH 1/3] build: Check for madvise syscall
Cyrill Gorcunov
gorcunov at gmail.com
Wed May 1 18:50:04 MSK 2019
Need to check if madvise is present in the system
Part of #3509
---
https://github.com/tarantool/tarantool/issues/3509
CMakeLists.txt | 11 +++++++++++
small/config.h.cmake | 9 +++++++++
2 files changed, 20 insertions(+)
create mode 100644 small/config.h.cmake
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ad27423..97d25bc 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,6 +1,8 @@
project(small C CXX)
cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
+include(CheckFunctionExists)
+
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Debug)
endif()
@@ -15,10 +17,19 @@ endif()
# Enable GNU glibc extentions.
add_definitions("-D_GNU_SOURCE")
+check_function_exists(madvise TARANTOOL_SMALL_HAS_MADVISE)
+
+configure_file(
+ "small/config.h.cmake"
+ "small/config.h"
+ )
+message (STATUS "")
+
# Valgrind
include_directories(third_party)
set(lib_headers
+ small/config.h
small/ibuf.h
small/lf_lifo.h
small/lifo.h
diff --git a/small/config.h.cmake b/small/config.h.cmake
new file mode 100644
index 0000000..1c9db10
--- /dev/null
+++ b/small/config.h.cmake
@@ -0,0 +1,9 @@
+#ifndef TARANTOOL_SMALL_CONFIG_H_INCLUDED
+#define TARANTOOL_SMALL_CONFIG_H_INCLUDED
+
+/*
+ * Defined if this platform has madvise(..).
+ */
+ #cmakedefine TARANTOOL_SMALL_HAS_MADVISE 1
+
+#endif /* TARANTOOL_SMALL_CONFIG_H_INCLUDED */
--
2.20.1
More information about the Tarantool-patches
mailing list