[libvirt PATCH v2 53/56] src: optionally include xlocale.h header

Daniel P. Berrangé berrange at redhat.com
Tue Jan 28 13:11:34 UTC 2020


On macOS some definitions are in xlocale.h, instead of in
locale.h. GNULIB hides this difference by making the latter
include the former.

Signed-off-by: Daniel P. Berrangé <berrange at redhat.com>
---
 configure.ac          | 1 +
 src/util/virgettext.c | 3 +++
 src/util/virstring.c  | 3 +++
 tests/vshtabletest.c  | 3 +++
 4 files changed, 10 insertions(+)

diff --git a/configure.ac b/configure.ac
index 005753e8a1..8692c40e86 100644
--- a/configure.ac
+++ b/configure.ac
@@ -400,6 +400,7 @@ AC_CHECK_HEADERS([\
   sys/syscall.h \
   sys/sysctl.h \
   sys/ucred.h \
+  xlocale.h \
   ])
 dnl Check whether endian provides handy macros.
 AC_CHECK_DECLS([htole64], [], [], [[#include <endian.h>]])
diff --git a/src/util/virgettext.c b/src/util/virgettext.c
index 7c12a5c142..8de8edb239 100644
--- a/src/util/virgettext.c
+++ b/src/util/virgettext.c
@@ -21,6 +21,9 @@
 #include <config.h>
 
 #include <locale.h>
+#ifdef HAVE_XLOCALE_H
+# include <xlocale.h>
+#endif
 
 #include "configmake.h"
 #include "internal.h"
diff --git a/src/util/virstring.c b/src/util/virstring.c
index fe5c026d2c..e9e792f3bf 100644
--- a/src/util/virstring.c
+++ b/src/util/virstring.c
@@ -20,6 +20,9 @@
 
 #include <glib/gprintf.h>
 #include <locale.h>
+#ifdef HAVE_XLOCALE_H
+# include <xlocale.h>
+#endif
 
 #include "virstring.h"
 #include "virthread.h"
diff --git a/tests/vshtabletest.c b/tests/vshtabletest.c
index 0feda90b52..55b795f99c 100644
--- a/tests/vshtabletest.c
+++ b/tests/vshtabletest.c
@@ -19,6 +19,9 @@
 #include <config.h>
 
 #include <locale.h>
+#ifdef HAVE_XLOCALE_H
+# include <xlocale.h>
+#endif
 #include <wchar.h>
 #include <wctype.h>
 
-- 
2.24.1




More information about the libvir-list mailing list