]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
libtextstyle: Fix compilation error on Android.
authorBruno Haible <bruno@clisp.org>
Mon, 2 Jan 2023 07:33:10 +0000 (08:33 +0100)
committerBruno Haible <bruno@clisp.org>
Mon, 2 Jan 2023 07:33:10 +0000 (08:33 +0100)
* libtextstyle/gnulib-local/m4/libglib.m4 (gl_LIBGLIB): Test whether struct
lconv has a 'decimal_point' field.
* libtextstyle/gnulib-local/lib/glib/gstrfuncs.c (g_ascii_strtod,
g_ascii_formatd): If struct lconv does not have a 'decimal_point' field, use "."
instead.

libtextstyle/gnulib-local/lib/glib/gstrfuncs.c
libtextstyle/gnulib-local/m4/libglib.m4

index 6ec6c693230fe536ab7720bcf6fa26ecb504b280..75a87e5ee1eafbead9ed0b0eeaa34c52b9542165 100644 (file)
@@ -1,5 +1,5 @@
 /* GLIB - Library of useful routines for C programming
- * Copyright (C) 2006-2019 Free Software Foundation, Inc.
+ * Copyright (C) 2006-2023 Free Software Foundation, Inc.
  *
  * This file is not part of the GNU gettext program, but is used with
  * GNU gettext.
@@ -372,7 +372,11 @@ g_ascii_strtod (const gchar *nptr,
   fail_pos = NULL;
 
   locale_data = localeconv ();
+#if HAVE_STRUCT_LCONV_DECIMAL_POINT
   decimal_point = locale_data->decimal_point;
+#else
+  decimal_point = ".";
+#endif
   decimal_point_len = strlen (decimal_point);
 
   g_assert (decimal_point_len != 0);
@@ -588,7 +592,11 @@ g_ascii_formatd (gchar       *buffer,
   _g_snprintf (buffer, buf_len, format, d);
 
   locale_data = localeconv ();
+#if HAVE_STRUCT_LCONV_DECIMAL_POINT
   decimal_point = locale_data->decimal_point;
+#else
+  decimal_point = ".";
+#endif
   decimal_point_len = strlen (decimal_point);
 
   g_assert (decimal_point_len != 0);
index 7ee5029e04b64820a54d3395177de2fec78ffae7..dbc9eb82ae16636bd73a0bd39bceb41864e5cb91 100644 (file)
@@ -1,5 +1,5 @@
-# libglib.m4 serial 6
-dnl Copyright (C) 2006-2007, 2019-2020 Free Software Foundation, Inc.
+# libglib.m4 serial 7
+dnl Copyright (C) 2006-2007, 2019-2023 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
@@ -127,6 +127,8 @@ AC_DEFUN([gl_LIBGLIB],
     AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
     AC_CHECK_HEADERS([unistd.h])
     dnl Don't bother checking for pthread.h and other multithread facilities.
+    AC_CHECK_MEMBERS([struct lconv.decimal_point], [], [],
+      [[#include <locale.h>]])
   else
     LIBGLIB_H=
   fi