mirror of
https://github.com/Relintai/sdl2_frt.git
synced 2024-12-20 22:16:49 +01:00
cmake: use check_symbol_exists, not check_function_exists (thanks, Manuel!)
This fixes the problem where we think iOS has fseeko64, etc, but doesn't. Fixes Bugzilla #4885.
This commit is contained in:
parent
c0a875faff
commit
952bac7c47
@ -15,7 +15,6 @@ project(SDL2 C CXX)
|
|||||||
# !!! FIXME: properly resolved.
|
# !!! FIXME: properly resolved.
|
||||||
#cmake_policy(SET CMP0042 OLD)
|
#cmake_policy(SET CMP0042 OLD)
|
||||||
|
|
||||||
include(CheckFunctionExists)
|
|
||||||
include(CheckLibraryExists)
|
include(CheckLibraryExists)
|
||||||
include(CheckIncludeFiles)
|
include(CheckIncludeFiles)
|
||||||
include(CheckIncludeFile)
|
include(CheckIncludeFile)
|
||||||
@ -789,7 +788,8 @@ if(LIBC)
|
|||||||
check_include_file("${_HEADER}" ${_HAVE_H})
|
check_include_file("${_HEADER}" ${_HAVE_H})
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
check_include_files("dlfcn.h;stdint.h;stddef.h;inttypes.h;stdlib.h;strings.h;string.h;float.h" STDC_HEADERS)
|
set(STDC_HEADER_NAMES "dlfcn.h;stdint.h;stddef.h;inttypes.h;stdlib.h;stdio.h;strings.h;wchar.h;string.h;float.h")
|
||||||
|
check_include_files("${STDC_HEADER_NAMES}" STDC_HEADERS)
|
||||||
check_type_size("size_t" SIZEOF_SIZE_T)
|
check_type_size("size_t" SIZEOF_SIZE_T)
|
||||||
check_symbol_exists(M_PI math.h HAVE_M_PI)
|
check_symbol_exists(M_PI math.h HAVE_M_PI)
|
||||||
# TODO: refine the mprotect check
|
# TODO: refine the mprotect check
|
||||||
@ -803,14 +803,21 @@ if(LIBC)
|
|||||||
_uitoa _ultoa strtol strtoul _i64toa _ui64toa strtoll strtoull
|
_uitoa _ultoa strtol strtoul _i64toa _ui64toa strtoll strtoull
|
||||||
atoi atof strcmp strncmp _stricmp strcasecmp _strnicmp strncasecmp
|
atoi atof strcmp strncmp _stricmp strcasecmp _strnicmp strncasecmp
|
||||||
wcscmp wcsdup wcslcat wcslcpy wcslen wcsncmp wcsstr
|
wcscmp wcsdup wcslcat wcslcpy wcslen wcsncmp wcsstr
|
||||||
sscanf vsscanf vsnprintf fopen64 fseeko fseeko64 sigaction setjmp
|
sscanf vsscanf vsnprintf fopen64 fseeko fseeko64 _Exit
|
||||||
nanosleep sysconf sysctlbyname getauxval poll _Exit
|
|
||||||
)
|
)
|
||||||
string(TOUPPER ${_FN} _UPPER)
|
string(TOUPPER ${_FN} _UPPER)
|
||||||
set(_HAVEVAR "HAVE_${_UPPER}")
|
set(_HAVEVAR "HAVE_${_UPPER}")
|
||||||
check_function_exists("${_FN}" ${_HAVEVAR})
|
check_symbol_exists("${_FN}" "${STDC_HEADER_NAMES}" ${_HAVEVAR})
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
|
check_symbol_exists(sigaction "signal.h" HAVE_SIGACTION)
|
||||||
|
check_symbol_exists(setjmp "setjmp.h" HAVE_SETJMP)
|
||||||
|
check_symbol_exists(nanosleep "time.h" HAVE_NANOSLEEP)
|
||||||
|
check_symbol_exists(sysconf "unistd.h" HAVE_SYSCONF)
|
||||||
|
check_symbol_exists(sysctlbyname "sys/types.h;sys/sysctl.h" HAVE_SYSCTLBYNAME)
|
||||||
|
check_symbol_exists(getauxval "sys/auxv.h" HAVE_GETAUXVAL)
|
||||||
|
check_symbol_exists(poll "poll.h" HAVE_POLL)
|
||||||
|
|
||||||
check_library_exists(m pow "" HAVE_LIBM)
|
check_library_exists(m pow "" HAVE_LIBM)
|
||||||
if(HAVE_LIBM)
|
if(HAVE_LIBM)
|
||||||
set(CMAKE_REQUIRED_LIBRARIES m)
|
set(CMAKE_REQUIRED_LIBRARIES m)
|
||||||
@ -821,7 +828,7 @@ if(LIBC)
|
|||||||
asin asinf trunc truncf)
|
asin asinf trunc truncf)
|
||||||
string(TOUPPER ${_FN} _UPPER)
|
string(TOUPPER ${_FN} _UPPER)
|
||||||
set(_HAVEVAR "HAVE_${_UPPER}")
|
set(_HAVEVAR "HAVE_${_UPPER}")
|
||||||
check_function_exists("${_FN}" ${_HAVEVAR})
|
check_symbol_exists("${_FN}" "math.h" ${_HAVEVAR})
|
||||||
endforeach()
|
endforeach()
|
||||||
set(CMAKE_REQUIRED_LIBRARIES)
|
set(CMAKE_REQUIRED_LIBRARIES)
|
||||||
list(APPEND EXTRA_LIBS m)
|
list(APPEND EXTRA_LIBS m)
|
||||||
@ -835,7 +842,7 @@ if(LIBC)
|
|||||||
|
|
||||||
if(NOT APPLE)
|
if(NOT APPLE)
|
||||||
check_include_file(alloca.h HAVE_ALLOCA_H)
|
check_include_file(alloca.h HAVE_ALLOCA_H)
|
||||||
check_function_exists(alloca HAVE_ALLOCA)
|
check_symbol_exists(alloca "alloca.h" HAVE_ALLOCA)
|
||||||
else()
|
else()
|
||||||
set(HAVE_ALLOCA_H 1)
|
set(HAVE_ALLOCA_H 1)
|
||||||
set(HAVE_ALLOCA 1)
|
set(HAVE_ALLOCA 1)
|
||||||
|
@ -30,7 +30,7 @@ macro(FindLibraryAndSONAME _LIB)
|
|||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
macro(CheckDLOPEN)
|
macro(CheckDLOPEN)
|
||||||
check_function_exists(dlopen HAVE_DLOPEN)
|
check_symbol_exists(dlopen "dlfcn.h" HAVE_DLOPEN)
|
||||||
if(NOT HAVE_DLOPEN)
|
if(NOT HAVE_DLOPEN)
|
||||||
foreach(_LIBNAME dl tdl)
|
foreach(_LIBNAME dl tdl)
|
||||||
check_library_exists("${_LIBNAME}" "dlopen" "" DLOPEN_LIB)
|
check_library_exists("${_LIBNAME}" "dlopen" "" DLOPEN_LIB)
|
||||||
@ -424,7 +424,7 @@ macro(CheckX11)
|
|||||||
set(X11_SHARED OFF)
|
set(X11_SHARED OFF)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
check_function_exists("shmat" HAVE_SHMAT)
|
check_symbol_exists(shmat "sys/shm.h" HAVE_SHMAT)
|
||||||
if(NOT HAVE_SHMAT)
|
if(NOT HAVE_SHMAT)
|
||||||
check_library_exists(ipc shmat "" HAVE_SHMAT)
|
check_library_exists(ipc shmat "" HAVE_SHMAT)
|
||||||
if(HAVE_SHMAT)
|
if(HAVE_SHMAT)
|
||||||
@ -476,7 +476,7 @@ macro(CheckX11)
|
|||||||
set(SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS 1)
|
set(SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS 1)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
check_function_exists(XkbKeycodeToKeysym SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM)
|
check_symbol_exists(XkbKeycodeToKeysym "X11/Xlib.h;X11/XKBlib.h" SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM)
|
||||||
|
|
||||||
if(VIDEO_X11_XCURSOR AND HAVE_XCURSOR_H)
|
if(VIDEO_X11_XCURSOR AND HAVE_XCURSOR_H)
|
||||||
set(HAVE_VIDEO_X11_XCURSOR TRUE)
|
set(HAVE_VIDEO_X11_XCURSOR TRUE)
|
||||||
@ -901,12 +901,14 @@ macro(CheckPTHREAD)
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
check_c_source_compiles("
|
check_include_files("pthread.h" HAVE_PTHREAD_H)
|
||||||
#include <pthread.h>
|
check_include_files("pthread_np.h" HAVE_PTHREAD_NP_H)
|
||||||
#include <pthread_np.h>
|
if (HAVE_PTHREAD_H)
|
||||||
int main(int argc, char** argv) { return 0; }" HAVE_PTHREAD_NP_H)
|
check_symbol_exists(pthread_setname_np "pthread.h" HAVE_PTHREAD_SETNAME_NP)
|
||||||
check_function_exists(pthread_setname_np HAVE_PTHREAD_SETNAME_NP)
|
if (HAVE_PTHREAD_NP_H)
|
||||||
check_function_exists(pthread_set_name_np HAVE_PTHREAD_SET_NAME_NP)
|
check_symbol_exists(pthread_set_name_np "pthread.h;pthread_np.h" HAVE_PTHREAD_SET_NAME_NP)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
set(SOURCE_FILES ${SOURCE_FILES}
|
set(SOURCE_FILES ${SOURCE_FILES}
|
||||||
${SDL2_SOURCE_DIR}/src/thread/pthread/SDL_systhread.c
|
${SDL2_SOURCE_DIR}/src/thread/pthread/SDL_systhread.c
|
||||||
|
Loading…
Reference in New Issue
Block a user