mirror of
https://github.com/isar/libmdbx.git
synced 2025-08-24 21:34:28 +08:00
mdbx: auto-define _GNU_SOURCE under control of MDBX_DISABLE_GNU_SOURCE.
Change-Id: I314d88b86517e3c44ad35fe02d3a27cb987c6d60
This commit is contained in:
@@ -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")
|
||||
|
Reference in New Issue
Block a user