diff options
author | Chris Robinson <[email protected]> | 2017-02-21 10:17:48 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2017-02-21 10:17:48 -0800 |
commit | e0e6efbfeac7bb07dce82b63b7688648e1067da3 (patch) | |
tree | 360263477886a3d9e624d07cbfb2993373a7b4fd /Alc | |
parent | bb4726d52038befc53ab219da8b75193a2605c5d (diff) |
Print warnings about missing libraries and functions
Diffstat (limited to 'Alc')
-rw-r--r-- | Alc/backends/alsa.c | 9 | ||||
-rw-r--r-- | Alc/backends/jack.c | 9 | ||||
-rw-r--r-- | Alc/backends/pulseaudio.c | 8 |
3 files changed, 24 insertions, 2 deletions
diff --git a/Alc/backends/alsa.c b/Alc/backends/alsa.c index 7a9045bb..2fa806ae 100644 --- a/Alc/backends/alsa.c +++ b/Alc/backends/alsa.c @@ -199,15 +199,21 @@ static ALCboolean alsa_load(void) #ifdef HAVE_DYNLOAD if(!alsa_handle) { + al_string missing_funcs = AL_STRING_INIT_STATIC(); + alsa_handle = LoadLib("libasound.so.2"); if(!alsa_handle) + { + WARN("Failed to load %s\n", "libasound.so.2"); return ALC_FALSE; + } error = ALC_FALSE; #define LOAD_FUNC(f) do { \ p##f = GetSymbol(alsa_handle, #f); \ if(p##f == NULL) { \ error = ALC_TRUE; \ + al_string_append_cstr(&missing_funcs, "\n" #f); \ } \ } while(0) ALSA_FUNCS(LOAD_FUNC); @@ -215,10 +221,11 @@ static ALCboolean alsa_load(void) if(error) { + WARN("Missing expected functions:%s\n", al_string_get_cstr(missing_funcs)); CloseLib(alsa_handle); alsa_handle = NULL; - return ALC_FALSE; } + al_string_deinit(&missing_funcs); } #endif diff --git a/Alc/backends/jack.c b/Alc/backends/jack.c index fa04c594..f1cd82bd 100644 --- a/Alc/backends/jack.c +++ b/Alc/backends/jack.c @@ -96,6 +96,8 @@ static ALCboolean jack_load(void) #ifdef HAVE_DYNLOAD if(!jack_handle) { + al_string missing_funcs = AL_STRING_INIT_STATIC(); + #ifdef _WIN32 #define JACKLIB "libjack.dll" #else @@ -103,13 +105,17 @@ static ALCboolean jack_load(void) #endif jack_handle = LoadLib(JACKLIB); if(!jack_handle) + { + WARN("Failed to load %s\n", JACKLIB); return ALC_FALSE; + } error = ALC_FALSE; #define LOAD_FUNC(f) do { \ p##f = GetSymbol(jack_handle, #f); \ if(p##f == NULL) { \ error = ALC_TRUE; \ + al_string_append_cstr(&missing_funcs, "\n" #f); \ } \ } while(0) JACK_FUNCS(LOAD_FUNC); @@ -117,10 +123,11 @@ static ALCboolean jack_load(void) if(error) { + WARN("Missing expected functions:%s\n", al_string_get_cstr(missing_funcs)); CloseLib(jack_handle); jack_handle = NULL; - return ALC_FALSE; } + al_string_deinit(&missing_funcs); } #endif diff --git a/Alc/backends/pulseaudio.c b/Alc/backends/pulseaudio.c index fa07da3e..14b37ee6 100644 --- a/Alc/backends/pulseaudio.c +++ b/Alc/backends/pulseaudio.c @@ -182,6 +182,8 @@ static ALCboolean pulse_load(void) #ifdef HAVE_DYNLOAD if(!pa_handle) { + al_string missing_funcs = AL_STRING_INIT_STATIC(); + #ifdef _WIN32 #define PALIB "libpulse-0.dll" #elif defined(__APPLE__) && defined(__MACH__) @@ -191,12 +193,16 @@ static ALCboolean pulse_load(void) #endif pa_handle = LoadLib(PALIB); if(!pa_handle) + { + WARN("Failed to load %s\n", PALIB); return ALC_FALSE; + } #define LOAD_FUNC(x) do { \ p##x = GetSymbol(pa_handle, #x); \ if(!(p##x)) { \ ret = ALC_FALSE; \ + al_string_append_cstr(&missing_funcs, "\n" #x); \ } \ } while(0) LOAD_FUNC(pa_context_unref); @@ -270,9 +276,11 @@ static ALCboolean pulse_load(void) if(ret == ALC_FALSE) { + WARN("Missing expected functions:%s\n", al_string_get_cstr(missing_funcs)); CloseLib(pa_handle); pa_handle = NULL; } + al_string_deinit(&missing_funcs); } #endif /* HAVE_DYNLOAD */ return ret; |