|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function(pcre2_use_system_extensions) |
|
|
if(WIN32) |
|
|
return() |
|
|
endif() |
|
|
|
|
|
set(first_run FALSE) |
|
|
set(found_macro FALSE) |
|
|
if(NOT DEFINED HAVE_GETRLIMIT_NAKED) |
|
|
set(first_run TRUE) |
|
|
message(STATUS "Detecting platform feature test macros") |
|
|
endif() |
|
|
|
|
|
include(CheckSymbolExists) |
|
|
include(CheckCSourceCompiles) |
|
|
include(CMakePushCheckState) |
|
|
|
|
|
cmake_push_check_state(RESET) |
|
|
set( |
|
|
_pcre2_test_src |
|
|
[=[ |
|
|
|
|
|
|
|
|
|
|
|
int main(void) { |
|
|
struct rlimit rlim; |
|
|
getrlimit(RLIMIT_STACK, &rlim); |
|
|
return 0; |
|
|
} |
|
|
]=] |
|
|
) |
|
|
set(CMAKE_REQUIRED_QUIET TRUE) |
|
|
check_c_source_compiles("${_pcre2_test_src}" HAVE_GETRLIMIT_NAKED) |
|
|
|
|
|
if(NOT HAVE_GETRLIMIT_NAKED) |
|
|
|
|
|
set(CMAKE_REQUIRED_DEFINITIONS "-D_ALL_SOURCE") |
|
|
check_c_source_compiles("${_pcre2_test_src}" HAVE_GETRLIMIT_ALLSOURCE) |
|
|
unset(CMAKE_REQUIRED_DEFINITIONS) |
|
|
|
|
|
if(HAVE_GETRLIMIT_ALLSOURCE) |
|
|
add_compile_definitions(_ALL_SOURCE) |
|
|
set(found_macro TRUE) |
|
|
if(first_run) |
|
|
message(STATUS "Detecting platform feature test macros - _ALL_SOURCE") |
|
|
endif() |
|
|
endif() |
|
|
endif() |
|
|
|
|
|
check_symbol_exists(mkostemp stdlib.h HAVE_MKOSTEMP_NAKED) |
|
|
|
|
|
if(NOT HAVE_MKOSTEMP_NAKED) |
|
|
|
|
|
set(CMAKE_REQUIRED_DEFINITIONS "-D_GNU_SOURCE") |
|
|
check_symbol_exists(mkostemp stdlib.h HAVE_MKOSTEMP_GNUSOURCE) |
|
|
unset(CMAKE_REQUIRED_DEFINITIONS) |
|
|
|
|
|
if(HAVE_MKOSTEMP_GNUSOURCE) |
|
|
add_compile_definitions(_GNU_SOURCE) |
|
|
set(found_macro TRUE) |
|
|
if(first_run) |
|
|
message(STATUS "Detecting platform feature test macros - _GNU_SOURCE") |
|
|
endif() |
|
|
endif() |
|
|
endif() |
|
|
|
|
|
if(first_run AND NOT found_macro) |
|
|
message(STATUS "Detecting platform feature test macros - none") |
|
|
endif() |
|
|
|
|
|
cmake_pop_check_state() |
|
|
endfunction() |
|
|
|