===================================================================
@@ -1170,8 +1170,18 @@
(r) = _size * GMP_NUMB_BITS - _cnt; \
} while (0)
-/* Needs <locale.h> */
-#ifdef HAVE_LOCALE_H
+/* MPFR_LCONV_DPTS can also be forced to 0 or 1 by the user. */
+#ifndef MPFR_LCONV_DPTS
+# if defined(HAVE_LOCALE_H) && \
+ defined(HAVE_STRUCT_LCONV_DECIMAL_POINT) && \
+ defined(HAVE_STRUCT_LCONV_THOUSANDS_SEP)
+# define MPFR_LCONV_DPTS 1
+# else
+# define MPFR_LCONV_DPTS 0
+# endif
+#endif
+
+#if MPFR_LCONV_DPTS
#include <locale.h>
/* Warning! In case of signed char, the value of MPFR_DECIMAL_POINT may
be negative (the ISO C99 does not seem to forbid negative values). */
===================================================================
@@ -832,6 +832,8 @@
return 0;
}
+#if MPFR_LCONV_DPTS
+
/* Check with locale "da_DK". On most platforms, decimal point is ','
and thousands separator is '.'; the test is not performed if this
is not the case or if the locale doesn't exist. */
@@ -878,6 +880,8 @@
return 0;
}
+#endif /* MPFR_LCONV_DPTS */
+
/* check concordance between mpfr_asprintf result with a regular mpfr float
and with a regular double float */
static int
@@ -1201,8 +1205,10 @@
check_emax ();
#if defined(HAVE_LOCALE_H) && defined(HAVE_SETLOCALE)
+#if MPFR_LCONV_DPTS
locale_da_DK ();
-
+ /* Avoid a warning by doing the setlocale outside of this #if */
+#endif
setlocale (LC_ALL, locale);
#endif
===================================================================
@@ -59,6 +59,10 @@
dnl sys/fpu.h - MIPS specific
AC_CHECK_HEADERS([sys/time.h sys/fpu.h])
+dnl Android has a <locale.h>, but not the following members.
+AC_CHECK_MEMBERS([struct lconv.decimal_point, struct lconv.thousands_sep],,,
+ [#include <locale.h>])
+
dnl Check how to get `alloca'
AC_FUNC_ALLOCA