Skip to content

Commit

Permalink
Check SDL_UDEV_DYNAMIC first, then SDL_UDEV_LIBS separately
Browse files Browse the repository at this point in the history
  • Loading branch information
flibitijibibo committed Oct 11, 2017
1 parent c0019b7 commit 84fb489
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions src/core/linux/SDL_udev.c
Expand Up @@ -36,14 +36,7 @@
#include "SDL_timer.h"
#include "../unix/SDL_poll.h"

static const char *SDL_UDEV_LIBS[] = {
#ifdef SDL_UDEV_DYNAMIC
SDL_UDEV_DYNAMIC
#else
"libudev.so.1",
"libudev.so.0"
#endif
};
static const char *SDL_UDEV_LIBS[] = { "libudev.so.1", "libudev.so.0" };

#define _THIS SDL_UDEV_PrivateData *_this
static _THIS = NULL;
Expand Down Expand Up @@ -261,6 +254,19 @@ SDL_UDEV_LoadLibrary(void)
return 0;
}

#ifdef SDL_UDEV_DYNAMIC
/* Check for the build environment's libudev first */
if (_this->udev_handle == NULL) {
_this->udev_handle = SDL_LoadObject(SDL_UDEV_DYNAMIC);
if (_this->udev_handle != NULL) {
retval = SDL_UDEV_load_syms();
if (retval < 0) {
SDL_UDEV_UnloadLibrary();
}
}
}
#endif

if (_this->udev_handle == NULL) {
for( i = 0 ; i < SDL_arraysize(SDL_UDEV_LIBS); i++) {
_this->udev_handle = SDL_LoadObject(SDL_UDEV_LIBS[i]);
Expand Down

0 comments on commit 84fb489

Please sign in to comment.