cmake: don't cache HAVE_xxx variables for checking libc features

main
Anonymous Maarten 2022-11-26 01:56:22 +01:00 committed by Anonymous Maarten
parent b2e428626b
commit 9d7e4a7d6e
1 changed files with 11 additions and 7 deletions

View File

@ -1068,9 +1068,11 @@ if(SDL_LIBC)
list(APPEND headers_to_check libunwind.h) list(APPEND headers_to_check libunwind.h)
endif() endif()
foreach(_HEADER ${headers_to_check}) foreach(_HEADER ${headers_to_check})
string(TOUPPER "HAVE_${_HEADER}" _UPPER) string(TOUPPER "${_HEADER}" HEADER_IDENTIFIER)
string(REGEX REPLACE "[./]" "_" _HAVE_H ${_UPPER}) string(REGEX REPLACE "[./]" "_" HEADER_IDENTIFIER "${HEADER_IDENTIFIER}")
check_include_file("${_HEADER}" ${_HAVE_H}) set(LIBC_HAS_VAR "LIBC_HAS_${HEADER_IDENTIFIER}")
check_include_file("${_HEADER}" "${LIBC_HAS_VAR}")
set(HAVE_${HEADER_IDENTIFIER} ${${LIBC_HAS_VAR}})
endforeach() endforeach()
check_include_file(linux/input.h HAVE_LINUX_INPUT_H) check_include_file(linux/input.h HAVE_LINUX_INPUT_H)
@ -1090,8 +1092,9 @@ if(SDL_LIBC)
sscanf vsscanf vsnprintf fopen64 fseeko fseeko64 _Exit sscanf vsscanf vsnprintf fopen64 fseeko fseeko64 _Exit
) )
string(TOUPPER ${_FN} _UPPER) string(TOUPPER ${_FN} _UPPER)
set(_HAVEVAR "HAVE_${_UPPER}") set(LIBC_HAS_VAR "LIBC_HAS_${_UPPER}")
check_symbol_exists("${_FN}" "${STDC_HEADER_NAMES}" ${_HAVEVAR}) check_symbol_exists("${_FN}" "${STDC_HEADER_NAMES}" ${LIBC_HAS_VAR})
set(HAVE_${_UPPER} ${${LIBC_HAS_VAR}})
endforeach() endforeach()
check_symbol_exists(sigaction "signal.h" HAVE_SIGACTION) check_symbol_exists(sigaction "signal.h" HAVE_SIGACTION)
@ -1112,8 +1115,9 @@ if(SDL_LIBC)
lround lroundf pow powf round roundf scalbn scalbnf sin sinf sqrt lround lroundf pow powf round roundf scalbn scalbnf sin sinf sqrt
sqrtf tan tanf acos acosf asin asinf trunc truncf) sqrtf tan tanf acos acosf asin asinf trunc truncf)
string(TOUPPER ${_FN} _UPPER) string(TOUPPER ${_FN} _UPPER)
set(_HAVEVAR "HAVE_${_UPPER}") set(LIBC_HASVAR "LIBC_HAS_${_UPPER}")
check_symbol_exists("${_FN}" "math.h" ${_HAVEVAR}) check_symbol_exists("${_FN}" "math.h" ${LIBC_HASVAR})
set(HAVE_${_UPPER} ${${LIBC_HASVAR}})
endforeach() endforeach()
set(CMAKE_REQUIRED_LIBRARIES) set(CMAKE_REQUIRED_LIBRARIES)
if(NOT VITA) if(NOT VITA)