Changeset View
Changeset View
Standalone View
Standalone View
src/config/CMakeLists.txt
Show First 20 Lines • Show All 50 Lines • ▼ Show 20 Lines | |||||
check_symbol_exists(bswap_32 "byteswap.h" HAVE_DECL_BSWAP_32) | check_symbol_exists(bswap_32 "byteswap.h" HAVE_DECL_BSWAP_32) | ||||
check_symbol_exists(bswap_64 "byteswap.h" HAVE_DECL_BSWAP_64) | check_symbol_exists(bswap_64 "byteswap.h" HAVE_DECL_BSWAP_64) | ||||
# sys/select.h and sys/prctl.h headers | # sys/select.h and sys/prctl.h headers | ||||
check_include_files("sys/select.h" HAVE_SYS_SELECT_H) | check_include_files("sys/select.h" HAVE_SYS_SELECT_H) | ||||
check_include_files("sys/prctl.h" HAVE_SYS_PRCTL_H) | check_include_files("sys/prctl.h" HAVE_SYS_PRCTL_H) | ||||
# Bitmanip intrinsics | # Bitmanip intrinsics | ||||
function(check_builtin_exist SYMBOL VARIABLE) | function(check_builtin_exist SYMBOL VARIABLE ARGS) | ||||
set( | set( | ||||
SOURCE_FILE | SOURCE_FILE | ||||
"${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckBuiltinExists.c" | "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckBuiltinExists.c" | ||||
) | ) | ||||
set( | set( | ||||
CMAKE_CONFIGURABLE_FILE_CONTENT | CMAKE_CONFIGURABLE_FILE_CONTENT | ||||
"int main(int argc, char** argv) { (void)argv; return ${SYMBOL}(argc); }\n" | "int main(int argc, char** argv) { (void)argv; return ${SYMBOL}(${ARGS}); }\n" | ||||
deadalnix: Why is that needed? | |||||
) | ) | ||||
configure_file( | configure_file( | ||||
"${CMAKE_ROOT}/Modules/CMakeConfigurableFile.in" | "${CMAKE_ROOT}/Modules/CMakeConfigurableFile.in" | ||||
"${SOURCE_FILE}" | "${SOURCE_FILE}" | ||||
@ONLY | @ONLY | ||||
) | ) | ||||
if(NOT CMAKE_REQUIRED_QUIET) | if(NOT CMAKE_REQUIRED_QUIET) | ||||
message(STATUS "Looking for ${SYMBOL}") | message(STATUS "Looking for ${SYMBOL}") | ||||
Show All 21 Lines | else() | ||||
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log | file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log | ||||
"Determining if the ${SYMBOL} " | "Determining if the ${SYMBOL} " | ||||
"exist failed with the following output:\n" | "exist failed with the following output:\n" | ||||
"${OUTPUT}\nFile ${SOURCEFILE}:\n" | "${OUTPUT}\nFile ${SOURCEFILE}:\n" | ||||
"${CMAKE_CONFIGURABLE_FILE_CONTENT}\n") | "${CMAKE_CONFIGURABLE_FILE_CONTENT}\n") | ||||
endif() | endif() | ||||
endfunction() | endfunction() | ||||
check_builtin_exist(__builtin_clz HAVE_DECL___BUILTIN_CLZ) | check_builtin_exist(__builtin_clz HAVE_DECL___BUILTIN_CLZ "argc") | ||||
check_builtin_exist(__builtin_clzl HAVE_DECL___BUILTIN_CLZL) | check_builtin_exist(__builtin_clzl HAVE_DECL___BUILTIN_CLZL "argc") | ||||
check_builtin_exist(__builtin_clzll HAVE_DECL___BUILTIN_CLZLL) | check_builtin_exist(__builtin_clzll HAVE_DECL___BUILTIN_CLZLL "argc") | ||||
check_builtin_exist(__builtin_popcount HAVE_DECL___BUILTIN_POPCOUNT) | check_builtin_exist(__builtin_popcount HAVE_DECL___BUILTIN_POPCOUNT "argc") | ||||
check_builtin_exist( | |||||
__builtin_saddll_overflow HAVE_DECL___BUILTIN_SADDLL_OVERFLOW | |||||
"argc, argc, (long long int*)&argc") | |||||
check_builtin_exist( | |||||
__builtin_ssubll_overflow HAVE_DECL___BUILTIN_SSUBLL_OVERFLOW | |||||
"argc, argc, (long long int*)&argc") | |||||
# Memory management capabilities | # Memory management capabilities | ||||
check_symbol_exists(M_ARENA_MAX "malloc.h" HAVE_MALLOPT_ARENA_MAX) | check_symbol_exists(M_ARENA_MAX "malloc.h" HAVE_MALLOPT_ARENA_MAX) | ||||
check_symbol_exists(malloc_info "malloc.h" HAVE_MALLOC_INFO) | check_symbol_exists(malloc_info "malloc.h" HAVE_MALLOC_INFO) | ||||
# Various system libraries | # Various system libraries | ||||
check_symbol_exists(strnlen "string.h" HAVE_DECL_STRNLEN) | check_symbol_exists(strnlen "string.h" HAVE_DECL_STRNLEN) | ||||
# daemon() is located in unistd.h on linux and in stdlib.h on BSDs and macOS. | # daemon() is located in unistd.h on linux and in stdlib.h on BSDs and macOS. | ||||
▲ Show 20 Lines • Show All 128 Lines • Show Last 20 Lines |
Why is that needed?