mirror of
https://github.com/isar/libmdbx.git
synced 2024-12-30 02:04:12 +08:00
mdbx: auto-define _GNU_SOURCE under control of MDBX_DISABLE_GNU_SOURCE.
Change-Id: I314d88b86517e3c44ad35fe02d3a27cb987c6d60
This commit is contained in:
parent
3c82ed0323
commit
7d621f6f0a
@ -291,7 +291,11 @@ add_mdbx_option(MDBX_ALLOY_BUILD "Build MDBX library as single object file" ON)
|
||||
add_mdbx_option(MDBX_TXN_CHECKOWNER "Checking transaction matches the calling thread inside libmdbx's API" ON)
|
||||
add_mdbx_option(MDBX_TXN_CHECKPID "Paranoid checking PID inside libmdbx's API" AUTO)
|
||||
mark_as_advanced(MDBX_TXN_CHECKPID)
|
||||
if(APPLE)
|
||||
if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
|
||||
add_mdbx_option(MDBX_DISABLE_GNU_SOURCE "Don't use nonstandard GNU/Linux extension functions" OFF)
|
||||
mark_as_advanced(MDBX_DISABLE_GNU_SOURCE)
|
||||
endif()
|
||||
if(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
|
||||
add_mdbx_option(MDBX_OSX_SPEED_INSTEADOF_DURABILITY "Disable use fcntl(F_FULLFSYNC) in favor of speed" OFF)
|
||||
mark_as_advanced(MDBX_OSX_SPEED_INSTEADOF_DURABILITY)
|
||||
endif()
|
||||
|
@ -20,7 +20,7 @@ suffix ?=
|
||||
|
||||
CC ?= gcc
|
||||
LD ?= ld
|
||||
MDBX_OPTIONS ?= -D_GNU_SOURCE=1 -DNDEBUG=1
|
||||
MDBX_OPTIONS ?= -DNDEBUG=1
|
||||
CFLAGS ?= -O2 -g3 -Wall -Werror -Wextra -ffunction-sections -fPIC -fvisibility=hidden -std=gnu11 -pthread
|
||||
|
||||
# LY: '--no-as-needed,-lrt' for ability to built with modern glibc, but then run with the old
|
||||
|
@ -28,6 +28,7 @@
|
||||
/* POSIX */
|
||||
#cmakedefine01 MDBX_USE_ROBUST
|
||||
#cmakedefine01 MDBX_USE_OFDLOCKS
|
||||
#cmakedefine01 MDBX_DISABLE_GNU_SOURCE
|
||||
|
||||
/* Simulate "AUTO" values of tristate options */
|
||||
#cmakedefine MDBX_TXN_CHECKPID_AUTO
|
||||
|
@ -15628,6 +15628,11 @@ __dll_export
|
||||
" MDBX_TXN_CHECKPID=" STRINGIFY(MDBX_TXN_CHECKPID)
|
||||
" MDBX_TXN_CHECKOWNER=" STRINGIFY(MDBX_TXN_CHECKOWNER)
|
||||
" MDBX_64BIT_ATOMIC=" STRINGIFY(MDBX_64BIT_ATOMIC)
|
||||
#ifdef _GNU_SOURCE
|
||||
" _GNU_SOURCE=YES"
|
||||
#else
|
||||
" _GNU_SOURCE=NO"
|
||||
#endif /* _GNU_SOURCE */
|
||||
#ifdef __APPLE__
|
||||
" MDBX_OSX_SPEED_INSTEADOF_DURABILITY=" STRINGIFY(MDBX_OSX_SPEED_INSTEADOF_DURABILITY)
|
||||
#endif /* MacOS */
|
||||
|
@ -49,6 +49,15 @@
|
||||
# define MDBX_INTERNAL_VAR extern
|
||||
#endif /* MDBX_ALLOY */
|
||||
|
||||
#ifndef MDBX_DISABLE_GNU_SOURCE
|
||||
#define MDBX_DISABLE_GNU_SOURCE 0
|
||||
#endif
|
||||
#if MDBX_DISABLE_GNU_SOURCE
|
||||
#undef _GNU_SOURCE
|
||||
#elif defined(__linux__) || defined(__gnu_linux__)
|
||||
#define _GNU_SOURCE
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
/* Should be defined before any includes */
|
||||
|
@ -1275,10 +1275,7 @@ retry_mapview:;
|
||||
return rc;
|
||||
#else
|
||||
if (limit != map->length) {
|
||||
#if defined(_GNU_SOURCE) && \
|
||||
!(defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || \
|
||||
defined(__BSD__) || defined(__NETBSD__) || defined(__bsdi__) || \
|
||||
defined(__DragonFly__) || defined(__APPLE__) || defined(__MACH__))
|
||||
#if defined(_GNU_SOURCE) && (defined(__linux__) || defined(__gnu_linux__))
|
||||
void *ptr = mremap(map->address, map->length, limit,
|
||||
/* LY: in case changing the mapping size calling code
|
||||
must guarantees the absence of competing threads, and
|
||||
@ -1292,7 +1289,7 @@ retry_mapview:;
|
||||
map->length = limit;
|
||||
#else
|
||||
return MDBX_RESULT_TRUE;
|
||||
#endif /* mremap() <= _GNU_SOURCE && !__FreeBSD__ */
|
||||
#endif /* _GNU_SOURCE && __linux__ */
|
||||
}
|
||||
return (flags & MDBX_RDONLY) ? MDBX_SUCCESS : mdbx_ftruncate(map->fd, size);
|
||||
#endif
|
||||
|
@ -13,7 +13,7 @@ set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
|
||||
# the RPATH to be used when installing, but only if it's not a system directory
|
||||
list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/lib" isSystemDir)
|
||||
if(isSystemDir EQUAL -1)
|
||||
if(APPLE)
|
||||
if(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
|
||||
set(CMAKE_INSTALL_RPATH "@executable_path/../lib")
|
||||
else()
|
||||
set(CMAKE_INSTALL_RPATH "\$ORIGIN/../lib")
|
||||
|
Loading…
x
Reference in New Issue
Block a user