From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Wed, 17 Oct 2018 10:13:16 +0300 From: Vladimir Davydov Subject: Re: [tarantool-patches] Re: [PATCH] cmake: fix sync_file_range detection Message-ID: <20181017071316.tdl22viclivsi2yo@esperanza> References: <20181016185526.GG5454@chai> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181016185526.GG5454@chai> To: Konstantin Osipov Cc: tarantool-patches@freelists.org, alexander.turenko@tarantool.org List-ID: On Tue, Oct 16, 2018 at 09:55:26PM +0300, Konstantin Osipov wrote: > * Vladimir Davydov [18/10/06 19:34]: > > 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) > > + > > Uhm, why are we defining this here and not where we check for sync > file range? We check for all symbols, including sync_file_range, right below. Some of them (e.g. mremap) might need _GNU_SOURCE too so I reckon we'd better define this macro before all the checks. > > > 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)