diff --git a/CMakeLists.txt b/CMakeLists.txt index 88997295fa..48ee15e8a1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,7 +14,7 @@ HunterGate( SHA1 "1b94f895831f76e5a63e0537dd366ae142543c02" ) -project(leveldb VERSION 0.1.0 LANGUAGES C CXX) +project(leveldb VERSION 1.20 LANGUAGES C CXX) option(LEVELDB_BUILD_TESTS "Build LevelDB's unit tests" ON) option(LEVELDB_BUILD_BENCHMARKS "Build LevelDB's benchmarks" ON) @@ -42,6 +42,11 @@ if(LEVELDB_WITH_SNAPPY) endif() include(CheckSymbolExists) +foreach(file_operation read write flush) + set(func "f${file_operation}_unlocked") + string(TOUPPER "HAVE_${func}" config_var) + check_symbol_exists("${func}" "unistd.h" ${config_var}) +endforeach() check_symbol_exists(fdatasync "unistd.h" HAVE_FDATASYNC) configure_file( diff --git a/port/port_config.h.in b/port/port_config.h.in index af27823911..b90894719a 100644 --- a/port/port_config.h.in +++ b/port/port_config.h.in @@ -5,10 +5,25 @@ #ifndef STORAGE_LEVELDB_PORT_PORT_CONFIG_H_ #define STORAGE_LEVELDB_PORT_PORT_CONFIG_H_ +// Define to 1 if you have a definition for fread_unlocked() in . +#if !defined(HAVE_FREAD_UNLOCKED) +#cmakedefine01 HAVE_FREAD_UNLOCKED +#endif // !defined(HAVE_FREAD_UNLOCKED) + +// Define to 1 if you have a definition for fwrite_unlocked() in . +#if !defined(HAVE_FWRITE_UNLOCKED) +#cmakedefine01 HAVE_FWRITE_UNLOCKED +#endif // !defined(HAVE_FWRITE_UNLOCKED) + +// Define to 1 if you have a definition for fflush_unlocked() in . +#if !defined(HAVE_FFLUSH_UNLOCKED) +#cmakedefine01 HAVE_FFLUSH_UNLOCKED +#endif // !defined(HAVE_FFLUSH_UNLOCKED) + // Define to 1 if you have a definition for fdatasync() in . -#if !defined(HAVE_FUNC_FDATASYNC) -#cmakedefine01 HAVE_FUNC_FDATASYNC -#endif // !defined(HAVE_FUNC_FDATASYNC) +#if !defined(HAVE_FDATASYNC) +#cmakedefine01 HAVE_FDATASYNC +#endif // !defined(HAVE_FDATASYNC) // Define to 1 if you have Google CRC32C. #if !defined(HAVE_CRC32C) diff --git a/port/port_posix.h b/port/port_posix.h index cb6dae7c17..869567d371 100644 --- a/port/port_posix.h +++ b/port/port_posix.h @@ -41,6 +41,21 @@ #define fdatasync fsync #endif // !HAVE_FDATASYNC +#if !HAVE_FREAD_UNLOCKED +// Use fread() on platforms without fread_unlocked() +#define fread_unlocked fread +#endif // !HAVE_FREAD_UNLOCKED + +#if !HAVE_FWRITE_UNLOCKED +// Use fwrite() on platforms without fwrite_unlocked() +#define fwrite_unlocked fwrite +#endif // !HAVE_FWRITE_UNLOCKED + +#if !HAVE_FFLUSH_UNLOCKED +// Use fflush() on platforms without fflush_unlocked() +#define fflush_unlocked fflush +#endif // !HAVE_FFLUSH_UNLOCKED + namespace leveldb { namespace port {