[gnome-desktop] Use xlocale.h - fixes build on MacOS (possibly also FreeBSD)
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-desktop] Use xlocale.h - fixes build on MacOS (possibly also FreeBSD)
- Date: Mon, 5 Apr 2021 17:22:22 +0000 (UTC)
commit 8ddb9dce8ffe070b151f4f7a383863d5f5f139b6
Author: Dan Cîrnaț <dan alt md>
Date: Mon Apr 5 09:28:18 2021 +0200
Use xlocale.h - fixes build on MacOS (possibly also FreeBSD)
xlocale.h contains the implementations for locale_t, newlocale and
uselocale on MacOS and FreeBSD
libgnome-desktop/gnome-gettext-portable.c | 3 +++
libgnome-desktop/gnome-gettext-portable.h | 4 ++++
meson.build | 1 +
tests/wall-clock.c | 2 ++
4 files changed, 10 insertions(+)
---
diff --git a/libgnome-desktop/gnome-gettext-portable.c b/libgnome-desktop/gnome-gettext-portable.c
index aaba4d08..75083eb2 100644
--- a/libgnome-desktop/gnome-gettext-portable.c
+++ b/libgnome-desktop/gnome-gettext-portable.c
@@ -20,6 +20,9 @@
#include "config.h"
#include <locale.h>
+#ifdef HAVE_XLOCALE
+#include <xlocale.h>
+#endif
#include <glib.h>
#include <glib/gi18n-lib.h>
diff --git a/libgnome-desktop/gnome-gettext-portable.h b/libgnome-desktop/gnome-gettext-portable.h
index c8af3691..9dd65712 100644
--- a/libgnome-desktop/gnome-gettext-portable.h
+++ b/libgnome-desktop/gnome-gettext-portable.h
@@ -23,6 +23,10 @@
#include <locale.h>
#include <string.h>
+#ifdef HAVE_XLOCALE
+#include <xlocale.h>
+#endif
+
const char *
dgettext_l (locale_t locale,
const char *domain,
diff --git a/meson.build b/meson.build
index 490d43e6..00cf25fb 100644
--- a/meson.build
+++ b/meson.build
@@ -95,6 +95,7 @@ conf.set('HAVE_XKBREGISTRY', xkbregistry_dep.found())
conf.set('HAVE_TIMERFD', cc.has_function('timerfd_create'))
conf.set('HAVE_OPENAT', cc.has_function('openat'))
conf.set('HAVE_USELOCALE', cc.has_function('uselocale'))
+conf.set('HAVE_XLOCALE', cc.has_header('xlocale.h'))
config_h = declare_dependency(
sources: configure_file(
diff --git a/tests/wall-clock.c b/tests/wall-clock.c
index a980c951..44bc93bb 100644
--- a/tests/wall-clock.c
+++ b/tests/wall-clock.c
@@ -17,6 +17,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+#include "config.h"
+
#include <gdesktop-enums.h>
#include <glib.h>
#define GNOME_DESKTOP_USE_UNSTABLE_API
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]