Check SDL_UDEV_DYNAMIC first, then SDL_UDEV_LIBS separately
authorEthan Lee <flibitijibibo@flibitijibibo.com>
Tue, 10 Oct 2017 20:22:15 -0400
changeset 115990f2de8f6c959
parent 11598 6fde74294cc9
child 11600 03f7e24556ab
Check SDL_UDEV_DYNAMIC first, then SDL_UDEV_LIBS separately
src/core/linux/SDL_udev.c
     1.1 --- a/src/core/linux/SDL_udev.c	Wed Oct 11 13:31:21 2017 -0700
     1.2 +++ b/src/core/linux/SDL_udev.c	Tue Oct 10 20:22:15 2017 -0400
     1.3 @@ -36,14 +36,7 @@
     1.4  #include "SDL_timer.h"
     1.5  #include "../unix/SDL_poll.h"
     1.6  
     1.7 -static const char *SDL_UDEV_LIBS[] = {
     1.8 -#ifdef SDL_UDEV_DYNAMIC
     1.9 -	SDL_UDEV_DYNAMIC
    1.10 -#else
    1.11 -	"libudev.so.1",
    1.12 -	"libudev.so.0"
    1.13 -#endif
    1.14 -};
    1.15 +static const char *SDL_UDEV_LIBS[] = { "libudev.so.1", "libudev.so.0" };
    1.16  
    1.17  #define _THIS SDL_UDEV_PrivateData *_this
    1.18  static _THIS = NULL;
    1.19 @@ -261,6 +254,19 @@
    1.20          return 0;
    1.21      }
    1.22  
    1.23 +#ifdef SDL_UDEV_DYNAMIC
    1.24 +    /* Check for the build environment's libudev first */
    1.25 +    if (_this->udev_handle == NULL) {
    1.26 +        _this->udev_handle = SDL_LoadObject(SDL_UDEV_DYNAMIC);
    1.27 +        if (_this->udev_handle != NULL) {
    1.28 +            retval = SDL_UDEV_load_syms();
    1.29 +            if (retval < 0) {
    1.30 +                SDL_UDEV_UnloadLibrary();
    1.31 +            }
    1.32 +        }
    1.33 +    }
    1.34 +#endif
    1.35 +
    1.36      if (_this->udev_handle == NULL) {
    1.37          for( i = 0 ; i < SDL_arraysize(SDL_UDEV_LIBS); i++) {
    1.38              _this->udev_handle = SDL_LoadObject(SDL_UDEV_LIBS[i]);