[PATCH] cmake: fix sync_file_range detection
Alexander Turenko
alexander.turenko at tarantool.org
Mon Oct 8 06:04:08 MSK 2018
On Sat, Oct 06, 2018 at 05:51:48PM +0300, Vladimir Davydov wrote:
> sync_file_range is declared only if _GNU_SOURCE macro is defined.
> Also, in order to be used in a source file, HAVE_SYNC_FILE_RANGE
> must be present in config.h.cmake.
>
> Fixes commit caae99e5eaa0 ("Refactor xlog writer").
> ---
> https://github.com/tarantool/tarantool/commits/dv/cmake-fix-gnu-symbol-detection
>
> CMakeLists.txt | 2 ++
> src/trivia/config.h.cmake | 1 +
> 2 files changed, 3 insertions(+)
>
> diff --git a/CMakeLists.txt b/CMakeLists.txt
> index bf68d187..b26d2abf 100644
> --- a/CMakeLists.txt
> +++ b/CMakeLists.txt
> @@ -69,6 +69,8 @@ include(cmake/profile.cmake)
> include(cmake/module.cmake)
> include(cmake/thread.cmake)
>
> +list(APPEND CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE)
> +
cmake/os.cmake already has `add_definitions("-D_GNU_SOURCE")`, is that
not sufficient?
> check_symbol_exists(MAP_ANON sys/mman.h HAVE_MAP_ANON)
> check_symbol_exists(MAP_ANONYMOUS sys/mman.h HAVE_MAP_ANONYMOUS)
> check_include_file(sys/time.h HAVE_SYS_TIME_H)
> diff --git a/src/trivia/config.h.cmake b/src/trivia/config.h.cmake
> index 66ddba99..8894b436 100644
> --- a/src/trivia/config.h.cmake
> +++ b/src/trivia/config.h.cmake
> @@ -167,6 +167,7 @@
> #cmakedefine HAVE_SCHED_YIELD 1
> #cmakedefine HAVE_POSIX_FADVISE 1
> #cmakedefine HAVE_MREMAP 1
> +#cmakedefine HAVE_SYNC_FILE_RANGE 1
>
> #cmakedefine HAVE_PRCTL_H 1
>
> --
> 2.11.0
>
More information about the Tarantool-patches
mailing list