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:
Ryan C. Gordon
2020-04-13 15:22:09 -04:00
parent c0a875faff
commit 952bac7c47
2 changed files with 25 additions and 16 deletions

View File

@@ -30,7 +30,7 @@ macro(FindLibraryAndSONAME _LIB)
endmacro()
macro(CheckDLOPEN)
check_function_exists(dlopen HAVE_DLOPEN)
check_symbol_exists(dlopen "dlfcn.h" HAVE_DLOPEN)
if(NOT HAVE_DLOPEN)
foreach(_LIBNAME dl tdl)
check_library_exists("${_LIBNAME}" "dlopen" "" DLOPEN_LIB)
@@ -424,7 +424,7 @@ macro(CheckX11)
set(X11_SHARED OFF)
endif()
check_function_exists("shmat" HAVE_SHMAT)
check_symbol_exists(shmat "sys/shm.h" HAVE_SHMAT)
if(NOT HAVE_SHMAT)
check_library_exists(ipc shmat "" HAVE_SHMAT)
if(HAVE_SHMAT)
@@ -476,7 +476,7 @@ macro(CheckX11)
set(SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS 1)
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)
set(HAVE_VIDEO_X11_XCURSOR TRUE)
@@ -901,12 +901,14 @@ macro(CheckPTHREAD)
endif()
endif()
check_c_source_compiles("
#include <pthread.h>
#include <pthread_np.h>
int main(int argc, char** argv) { return 0; }" HAVE_PTHREAD_NP_H)
check_function_exists(pthread_setname_np HAVE_PTHREAD_SETNAME_NP)
check_function_exists(pthread_set_name_np HAVE_PTHREAD_SET_NAME_NP)
check_include_files("pthread.h" HAVE_PTHREAD_H)
check_include_files("pthread_np.h" HAVE_PTHREAD_NP_H)
if (HAVE_PTHREAD_H)
check_symbol_exists(pthread_setname_np "pthread.h" HAVE_PTHREAD_SETNAME_NP)
if (HAVE_PTHREAD_NP_H)
check_symbol_exists(pthread_set_name_np "pthread.h;pthread_np.h" HAVE_PTHREAD_SET_NAME_NP)
endif()
endif()
set(SOURCE_FILES ${SOURCE_FILES}
${SDL2_SOURCE_DIR}/src/thread/pthread/SDL_systhread.c