mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-09-29 06:28:29 +00:00
configuration updates for dlopen:
- cmake, configure (CheckDLOPEN): --enable-sdl-dlopen is now history.. detach the dl api discovery from SDL_LOADSO_DLOPEN functionality. define HAVE_DLOPEN. also define DYNAPI_NEEDS_DLOPEN (CheckDLOPEN is called only for relevant platforms.) - update SDL_config.in and SDL_config.cmake accordingly. - SDL_dynapi.h: set SDL_DYNAMIC_API to 0 if DYNAPI_NEEDS_DLOPEN is defined, but HAVE_DLOPEN is not. - pthread/SDL_systhread.c: conditionalize dl api use to HAVE_DLOPEN - SDL_x11opengl.c, SDL_DirectFB_opengl.c, SDL_naclopengles.c: rely on HAVE_DLOPEN, not SDL_LOADSO_DLOPEN. - SDL_config_android.h, SDL_config_iphoneos.h, SDL_config_macosx.h, SDL_config_pandora.h, and SDL_config_wiz.h: define HAVE_DLOPEN. Closes: https://github.com/libsdl-org/SDL/pull/4351
This commit is contained in:

committed by
Sam Lantinga

parent
cb0fd05eeb
commit
77c8d11137
@@ -41,7 +41,7 @@
|
||||
#include "../../core/linux/SDL_dbus.h"
|
||||
#endif /* __LINUX__ */
|
||||
|
||||
#if defined(__LINUX__) || defined(__MACOSX__) || defined(__IPHONEOS__)
|
||||
#if (defined(__LINUX__) || defined(__MACOSX__) || defined(__IPHONEOS__)) && defined(HAVE_DLOPEN)
|
||||
#include <dlfcn.h>
|
||||
#ifndef RTLD_DEFAULT
|
||||
#define RTLD_DEFAULT NULL
|
||||
@@ -78,10 +78,10 @@ RunThread(void *data)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#if defined(__MACOSX__) || defined(__IPHONEOS__)
|
||||
#if (defined(__MACOSX__) || defined(__IPHONEOS__)) && defined(HAVE_DLOPEN)
|
||||
static SDL_bool checked_setname = SDL_FALSE;
|
||||
static int (*ppthread_setname_np)(const char*) = NULL;
|
||||
#elif defined(__LINUX__)
|
||||
#elif defined(__LINUX__) && defined(HAVE_DLOPEN)
|
||||
static SDL_bool checked_setname = SDL_FALSE;
|
||||
static int (*ppthread_setname_np)(pthread_t, const char*) = NULL;
|
||||
#endif
|
||||
@@ -91,7 +91,7 @@ SDL_SYS_CreateThread(SDL_Thread * thread)
|
||||
pthread_attr_t type;
|
||||
|
||||
/* do this here before any threads exist, so there's no race condition. */
|
||||
#if defined(__MACOSX__) || defined(__IPHONEOS__) || defined(__LINUX__)
|
||||
#if (defined(__MACOSX__) || defined(__IPHONEOS__) || defined(__LINUX__)) && defined(HAVE_DLOPEN)
|
||||
if (!checked_setname) {
|
||||
void *fn = dlsym(RTLD_DEFAULT, "pthread_setname_np");
|
||||
#if defined(__MACOSX__) || defined(__IPHONEOS__)
|
||||
@@ -131,7 +131,7 @@ SDL_SYS_SetupThread(const char *name)
|
||||
#endif /* !__NACL__ */
|
||||
|
||||
if (name != NULL) {
|
||||
#if defined(__MACOSX__) || defined(__IPHONEOS__) || defined(__LINUX__)
|
||||
#if (defined(__MACOSX__) || defined(__IPHONEOS__) || defined(__LINUX__)) && defined(HAVE_DLOPEN)
|
||||
SDL_assert(checked_setname);
|
||||
if (ppthread_setname_np != NULL) {
|
||||
#if defined(__MACOSX__) || defined(__IPHONEOS__)
|
||||
|
Reference in New Issue
Block a user