From 15b8a93426dff14b43cc5e1dc340a869a0096f02 Mon Sep 17 00:00:00 2001
From: Bruno Haible <bruno@clisp.org>
Date: Sun, 22 Nov 2009 23:32:54 +0100
Subject: [PATCH] Check that <locale.h> defines locale_t and LC_GLOBAL_LOCALE.

---
 ChangeLog            | 4 ++++
 modules/locale-tests | 1 +
 tests/test-locale.c  | 5 +++++
 3 files changed, 10 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 3e7980f5c3..394c56c80d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2009-11-22  Bruno Haible  <bruno@clisp.org>
 
+	* modules/locale-tests (configure.ac): Test for newlocale function.
+	* tests/test-locale.c: When the system has extended locale functions,
+	verify that <locale.h> defines locale_t and LC_GLOBAL_LOCALE.
+
 	locale: Make locale_t available when possible.
 	* lib/locale.in.h: Include <xlocale.h> when it exists.
 	* m4/locale_h.m4 (gl_LOCALE_H): Check for <xlocale.h> and arrange to
diff --git a/modules/locale-tests b/modules/locale-tests
index 19bc373cb9..1e6a0e8a89 100644
--- a/modules/locale-tests
+++ b/modules/locale-tests
@@ -5,6 +5,7 @@ Depends-on:
 verify
 
 configure.ac:
+AC_CHECK_FUNCS_ONCE([newlocale])
 
 Makefile.am:
 TESTS += test-locale
diff --git a/tests/test-locale.c b/tests/test-locale.c
index 625cc43d84..5bd7371f61 100644
--- a/tests/test-locale.c
+++ b/tests/test-locale.c
@@ -33,6 +33,11 @@ int a[] =
     LC_TIME
   };
 
+#if HAVE_NEWLOCALE
+/* Check that the locale_t type and the LC_GLOBAL_LOCALE macro are defined.  */
+locale_t b = LC_GLOBAL_LOCALE;
+#endif
+
 /* Check that NULL can be passed through varargs as a pointer type,
    per POSIX 2008.  */
 verify (sizeof NULL == sizeof (void *));
-- 
2.30.2