Repository: libsdl-org/SDL
File: src/video/wayland/SDL_waylanddyn.c (C)

Code before:
#define SDL_WAYLAND_CURSOR_APPEND ,SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_CURSOR
#else
#define SDL_WAYLAND_CURSOR_APPEND
#endif
#ifdef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XKBCOMMON
#define SDL_WAYLAND_XKBCOMMON_APPEND ,SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XKBCOMMON
#else
#define SDL_WAYLAND_XKBCOMMON_APPEND
#endif
#ifdef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_LIBDECOR
#define SDL_WAYLAND_LIBDECOR_APPEND ,SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_LIBDECOR
#else
#define SDL_WAYLAND_LIBDECOR_APPEND
#endif

#define SDL_WAYLAND_DYNAMIC_LIBS \
    SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC \
    SDL_WAYLAND_EGL_APPEND \
    SDL_WAYLAND_CURSOR_APPEND \
    SDL_WAYLAND_XKBCOMMON_APPEND \
    SDL_WAYLAND_LIBDECOR_APPEND

SDL_ELF_NOTE_DLOPEN(
    "wayland",
    "Support for Wayland video",
    SDL_ELF_NOTE_DLOPEN_PRIORITY_REQUIRED,
    SDL_WAYLAND_DYNAMIC_LIBS
);

static const char *waylandlibnames[] = {
    SDL_WAYLAND_DYNAMIC_LIBS
};

static SDL_SharedObject *waylandlibs[SDL_arraysize(waylandlibnames)];

static void *WAYLAND_GetSym(const char *fnname, int *pHasModule, bool required)
{
    size_t i;
    void *fn = NULL;
    for (i = 0; i < SDL_arraysize(waylandlibnames); i++) {
        if (waylandlibs[i]) {
            fn = SDL_LoadFunction(waylandlibs[i], fnname);
            if (fn) {
                break;
            }
        }
    }

#if DEBUG_DYNAMIC_WAYLAND
    if (fn) {
        SDL_Log("WAYLAND: Found '%s' in %s (%p)", fnname, dynlib->libname, fn);

Review comment (suggestion):
I think these should be `RECOMMENDED` or even `SUGGESTED`. You don't need Wayland libraries unless you are actually running on Wayland, and if packagers are OK with having a hard dependency then they can turn off `SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC`.

Code after:
#ifdef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL
SDL_ELF_NOTE_DLOPEN(
    "wayland",
    "Support for Wayland video",
    SDL_ELF_NOTE_DLOPEN_PRIORITY_SUGGESTED,
    SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL
);
#endif
#ifdef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_CURSOR
SDL_ELF_NOTE_DLOPEN(
    "wayland",
    "Support for Wayland video",
    SDL_ELF_NOTE_DLOPEN_PRIORITY_SUGGESTED,
    SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_CURSOR
);
#endif
#ifdef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XKBCOMMON
SDL_ELF_NOTE_DLOPEN(
    "wayland",
    "Support for Wayland video",
    SDL_ELF_NOTE_DLOPEN_PRIORITY_SUGGESTED,
    SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XKBCOMMON
);
#endif
#ifdef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_LIBDECOR
SDL_ELF_NOTE_DLOPEN(
    "wayland",
    "Support for Wayland video",
    SDL_ELF_NOTE_DLOPEN_PRIORITY_SUGGESTED,
    SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_LIBDECOR
);
#endif

typedef struct
{
    SDL_SharedObject *lib;
    const char *libname;
} waylanddynlib;

static waylanddynlib waylandlibs[] = {
    { NULL, SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC },
#ifdef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL
    { NULL, SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL },
#endif
#ifdef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_CURSOR
    { NULL, SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_CURSOR },
#endif
#ifdef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XKBCOMMON
    { NULL, SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XKBCOMMON },
#endif
#ifdef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_LIBDECOR