From f1d2bf84089b1e5b5988a5e5d6d571a507a52337 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 6 Aug 2008 18:54:13 +0200 Subject: add i18n support --- src/daemon/ltdl-bind-now.c | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) (limited to 'src/daemon/ltdl-bind-now.c') diff --git a/src/daemon/ltdl-bind-now.c b/src/daemon/ltdl-bind-now.c index b1770674..40077248 100644 --- a/src/daemon/ltdl-bind-now.c +++ b/src/daemon/ltdl-bind-now.c @@ -32,13 +32,12 @@ #include #endif -#ifndef HAVE_STRUCT_LT_USER_DLLOADER -/* Only used with ltdl 2.2 */ #include -#endif #include +#include + #include #include #include @@ -54,6 +53,8 @@ #undef PA_BIND_NOW #endif +#ifdef HAVE_LT_DLMUTEX_REGISTER + static pa_mutex *libtool_mutex = NULL; PA_STATIC_TLS_DECLARE_NO_FREE(libtool_tls); @@ -74,6 +75,8 @@ static const char *libtool_get_error(void) { return PA_STATIC_TLS_GET(libtool_tls); } +#endif + #ifdef PA_BIND_NOW /* @@ -89,10 +92,11 @@ static const char *libtool_get_error(void) { */ #ifndef HAVE_LT_DLADVISE -static lt_module bind_now_open(lt_user_data d, const char *fname) { +static lt_module bind_now_open(lt_user_data d, const char *fname) #else - static lt_module bind_now_open(lt_user_data d, const char *fname, lt_dladvise advise) { +static lt_module bind_now_open(lt_user_data d, const char *fname, lt_dladvise advise) #endif +{ lt_module m; pa_assert(fname); @@ -150,8 +154,9 @@ void pa_ltdl_init(void) { #endif pa_assert_se(lt_dlinit() == 0); - pa_assert_se(libtool_mutex = pa_mutex_new(TRUE, FALSE)); + #ifdef HAVE_LT_DLMUTEX_REGISTER + pa_assert_se(libtool_mutex = pa_mutex_new(TRUE, FALSE)); pa_assert_se(lt_dlmutex_register(libtool_lock, libtool_unlock, libtool_set_error, libtool_get_error) == 0); #endif @@ -163,14 +168,15 @@ void pa_ltdl_init(void) { /* Add our BIND_NOW loader as the default module loader. */ if (lt_dlloader_add(place, &loader, "bind-now-loader") != 0) - pa_log_warn("Failed to add bind-now-loader."); + pa_log_warn(_("Failed to add bind-now-loader.")); # else /* Already initialised */ - if ( dlopen_loader != NULL ) return; + if (dlopen_loader) + return; if (!(dlopen_loader = lt_dlloader_find("dlopen"))) { - pa_log_warn("Failed to find original dlopen loader."); - return; + pa_log_warn(_("Failed to find original dlopen loader.")); + return; } memcpy(&bindnow_loader, dlopen_loader, sizeof(bindnow_loader)); @@ -182,14 +188,16 @@ void pa_ltdl_init(void) { /* Add our BIND_NOW loader as the default module loader. */ if (lt_dlloader_add(&bindnow_loader) != 0) - pa_log_warn("Failed to add bind-now-loader."); + pa_log_warn(_("Failed to add bind-now-loader.")); # endif #endif } void pa_ltdl_done(void) { pa_assert_se(lt_dlexit() == 0); + +#ifdef HAVE_LT_DLMUTEX_REGISTER pa_mutex_free(libtool_mutex); libtool_mutex = NULL; +#endif } - -- cgit From 8a3d666da390b1356f5545649e23bda7ccb6d710 Mon Sep 17 00:00:00 2001 From: Diego 'Flameeyes' Pettenò Date: Fri, 8 Aug 2008 12:39:04 +0200 Subject: Fix building again libtool/ltdl 2.2.4. On changeset f1d2bf84089b1e5b5988a5e5d6d571a507a52337 support for libtool 2.2 was broken as libtool_set_error was not defined anymore on that version. Fix this by also putting under #ifdef the calls to that function. --- src/daemon/ltdl-bind-now.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/daemon/ltdl-bind-now.c') diff --git a/src/daemon/ltdl-bind-now.c b/src/daemon/ltdl-bind-now.c index 40077248..1215d125 100644 --- a/src/daemon/ltdl-bind-now.c +++ b/src/daemon/ltdl-bind-now.c @@ -102,7 +102,9 @@ static lt_module bind_now_open(lt_user_data d, const char *fname, lt_dladvise ad pa_assert(fname); if (!(m = dlopen(fname, PA_BIND_NOW))) { +#ifdef HAVE_LT_DLMUTEX_REGISTER libtool_set_error(dlerror()); +#endif return NULL; } @@ -114,7 +116,9 @@ static int bind_now_close(lt_user_data d, lt_module m) { pa_assert(m); if (dlclose(m) != 0){ +#ifdef HAVE_LT_DLMUTEX_REGISTER libtool_set_error(dlerror()); +#endif return 1; } @@ -128,7 +132,9 @@ static lt_ptr bind_now_find_sym(lt_user_data d, lt_module m, const char *symbol) pa_assert(symbol); if (!(ptr = dlsym(m, symbol))) { +#ifdef HAVE_LT_DLMUTEX_REGISTER libtool_set_error(dlerror()); +#endif return NULL; } -- cgit From 74719c24f561cd04ba430a69a8885e7b4a05edb6 Mon Sep 17 00:00:00 2001 From: Russ Dill Date: Sun, 17 Aug 2008 12:53:43 -0700 Subject: Fix up overzealous HAVE_LT_DLMUTEX_REGISTER block This fixes a built problem on systems without the lt_dlmutex_register function. The overzealousness causes libtool_set_error and libtool_get_error to be undefined. This fixes a build problem on Ubuntu Intrepid. Signed-off-by: Russ Dill Signed-off-by: Lennart Poettering --- src/daemon/ltdl-bind-now.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/daemon/ltdl-bind-now.c') diff --git a/src/daemon/ltdl-bind-now.c b/src/daemon/ltdl-bind-now.c index 40077248..bb5a196e 100644 --- a/src/daemon/ltdl-bind-now.c +++ b/src/daemon/ltdl-bind-now.c @@ -57,8 +57,6 @@ static pa_mutex *libtool_mutex = NULL; -PA_STATIC_TLS_DECLARE_NO_FREE(libtool_tls); - static void libtool_lock(void) { pa_mutex_lock(libtool_mutex); } @@ -67,6 +65,10 @@ static void libtool_unlock(void) { pa_mutex_unlock(libtool_mutex); } +#endif + +PA_STATIC_TLS_DECLARE_NO_FREE(libtool_tls); + static void libtool_set_error(const char *error) { PA_STATIC_TLS_SET(libtool_tls, (char*) error); } @@ -75,8 +77,6 @@ static const char *libtool_get_error(void) { return PA_STATIC_TLS_GET(libtool_tls); } -#endif - #ifdef PA_BIND_NOW /* -- cgit From b7026bf248948a6a30386ddbcc137f48f369a51e Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Tue, 19 Aug 2008 22:39:54 +0200 Subject: add a few more gcc warning flags and fix quite a few problems found by doing so --- src/daemon/ltdl-bind-now.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/daemon/ltdl-bind-now.c') diff --git a/src/daemon/ltdl-bind-now.c b/src/daemon/ltdl-bind-now.c index 42c3b231..92e5d40d 100644 --- a/src/daemon/ltdl-bind-now.c +++ b/src/daemon/ltdl-bind-now.c @@ -24,11 +24,11 @@ #include #endif -#if HAVE_DLFCN_H +#ifdef HAVE_DLFCN_H #include #endif -#if HAVE_SYS_DL_H +#ifdef HAVE_SYS_DL_H #include #endif -- cgit