diff --git a/CMakeLists.txt b/CMakeLists.txt index 7dbad83..a24d967 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -62,6 +62,8 @@ INCLUDE(CheckCSourceCompiles) CHECK_FUNCTION_EXISTS(sync_file_range HAVE_SYNC_FILE_RANGE) CHECK_FUNCTION_EXISTS(fdatasync HAVE_FDATASYNC) CHECK_FUNCTION_EXISTS(tdestroy HAVE_TDESTROY) +SET(CMAKE_REQUIRED_FLAGS "-lm") +CHECK_FUNCTION_EXISTS(powl HAVE_POWL) CHECK_C_SOURCE_COMPILES("#define _GNU_SOURCE #include #include @@ -127,23 +129,31 @@ INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/build LINK_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/src/stasis) IF ( "${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" ) - SET(COMMON_LIBRARIES stasis m pthread) + SET(COMMON_LIBRARIES stasis m pthread stdc++) SET(CMAKE_C_FLAGS "-g -Wall -pedantic -std=gnu99 -DPBL_COMPAT -D_FILE_OFFSET_BITS=64 ${CMAKE_C_FLAGS}") SET(CMAKE_CXX_FLAGS "-g -Wall -Wno-variadic-macros -Wno-long-long -pedantic -DPBL_COMPAT -D_FILE_OFFSET_BITS=64 ${CMAKE_CXX_FLAGS}") ELSEIF ( "${CMAKE_C_COMPILER_ID}" STREQUAL "SunPro" ) SET(COMMON_LIBRARIES stasis m pthread Crun Cstd) SET(CMAKE_C_FLAGS "-g -xc99=all -DPBL_COMPAT -D_FILE_OFFSET_BITS=64 ${CMAKE_C_FLAGS}") SET(CMAKE_CXX_FLAGS "-g -DPBL_COMPAT -D_FILE_OFFSET_BITS=64 ${CMAKE_CXX_FLAGS}") -ENDIF () +ELSE( "${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" ) + # TODO: how to detect compilers correctly on old cmake??? This is a huge hack; it uses old gcc + # options, since cmake is old... + SET(COMMON_LIBRARIES stasis m pthread stdc++) + SET(CMAKE_C_FLAGS "-g -Wall -pedantic -std=gnu99 -DPBL_COMPAT -D_FILE_OFFSET_BITS=64 ${CMAKE_C_FLAGS}") + SET(CMAKE_CXX_FLAGS "-g -Wall -Wno-long-long -pedantic -DPBL_COMPAT -D_FILE_OFFSET_BITS=64 ${CMAKE_CXX_FLAGS}") +ENDIF ( "${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" ) INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/src/stasis DESTINATION include/ - FILES_MATCHING PATTERN "*.h" + #FILES_MATCHING + PATTERN "*.h" PATTERN ".svn" EXCLUDE PATTERN ".deps" EXCLUDE) INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/stasis DESTINATION include/ - FILES_MATCHING PATTERN "*.h" + #FILES_MATCHING + PATTERN "*.h" PATTERN ".svn" EXCLUDE PATTERN ".deps" EXCLUDE) diff --git a/config.h.cmake b/config.h.cmake index 6764069..52b4496 100644 --- a/config.h.cmake +++ b/config.h.cmake @@ -6,6 +6,7 @@ #cmakedefine HAVE_PTHREAD_STACK_MIN #cmakedefine HAVE_ALLOCA_H #cmakedefine HAVE_TDESTROY +#cmakedefine HAVE_POWL #ifndef HAVE_PTHREAD_STACK_MIN #define PTHREAD_STACK_MIN 32768 // wild guess. diff --git a/src/stasis/operations/arrayList.c b/src/stasis/operations/arrayList.c index f6f9855..1a473f3 100644 --- a/src/stasis/operations/arrayList.c +++ b/src/stasis/operations/arrayList.c @@ -207,7 +207,11 @@ compensated_function int TarrayListExtend(int xid, recordid rid, int slots) { try_ret(compensation_error()) { for(pageid_t i = lastCurrentBlock+1; i <= lastNewBlock; i++) { /* Alloc block i */ +#ifdef HAVE_POWL pageid_t blockSize = alp.initialSize * powl(alp.multiplier, i); +#else + pageid_t blockSize = alp.initialSize * powf(alp.multiplier, i); +#endif pageid_t newFirstPage = TpageAllocMany(xid, blockSize); DEBUG("block %d\n", i); tmp.slot = i + FIRST_DATA_PAGE_OFFSET;