summaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2019-02-01 03:12:28 +0100
committerBruno Haible <bruno@clisp.org>2019-02-01 03:12:28 +0100
commit97e23d40a659c85048b59852e1871823f727aeb2 (patch)
tree3af9ca8e63074de5b0b42826f24d18a4c5932dc5 /m4
parentcd825c6d50babc1f4fbaccfee3fff1785fe23cc3 (diff)
downloadgnulib-97e23d40a659c85048b59852e1871823f727aeb2.tar.gz
strtod, strtold: Use the locale's decimal point.
* lib/strtod.c: Include <locale.h>, <stdio.h>, <langinfo.h>. (decimal_point_char): New function, copied from lib/vasnprintf.c. (parse_number): Add a radixchar argument. Use it instead of '.'. (STRTOD): Invoke decimal_point_char and pass the result to parse_number. * m4/strtod.m4 (gl_PREREQ_STRTOD): Test whether nl_langinfo exists. * m4/strtold.m4 (gl_PREREQ_STRTOLD): Likewise. * tests/test-strtod1.c: New file. * tests/test-strtod1.sh: New file. * modules/strtod-tests (Files): Add test-strtod1.{sh,c}. Add locale-fr.m4 and its dependencies. (configure.ac): Invoke gt_LOCALE_FR, gt_LOCALE_FR_UTF8. (Makefile.am): Arrange to compile test-strtod1.c and run test-strtod1.sh. * tests/test-strtold1.c: New file. * tests/test-strtold1.sh: New file. * modules/strtold-tests (Files): Add test-strtold1.{sh,c}. Add locale-fr.m4 and its dependencies. (configure.ac): Invoke gt_LOCALE_FR, gt_LOCALE_FR_UTF8. (Makefile.am): Arrange to compile test-strtold1.c and run test-strtold1.sh.
Diffstat (limited to 'm4')
-rw-r--r--m4/strtod.m43
-rw-r--r--m4/strtold.m43
2 files changed, 4 insertions, 2 deletions
diff --git a/m4/strtod.m4 b/m4/strtod.m4
index 97fb39b52f..99122178a0 100644
--- a/m4/strtod.m4
+++ b/m4/strtod.m4
@@ -1,4 +1,4 @@
-# strtod.m4 serial 23
+# strtod.m4 serial 24
dnl Copyright (C) 2002-2003, 2006-2019 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -138,4 +138,5 @@ AC_DEFUN([gl_PREREQ_STRTOD], [
AC_DEFINE([HAVE_LDEXP_IN_LIBC], [1],
[Define if the ldexp function is available in libc.])
fi
+ AC_CHECK_FUNCS([nl_langinfo])
])
diff --git a/m4/strtold.m4 b/m4/strtold.m4
index 117b7f1856..c1c05d1a7a 100644
--- a/m4/strtold.m4
+++ b/m4/strtold.m4
@@ -1,4 +1,4 @@
-# strtold.m4 serial 1
+# strtold.m4 serial 2
dnl Copyright (C) 2002-2003, 2006-2019 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -117,4 +117,5 @@ AC_DEFUN([gl_PREREQ_STRTOLD], [
AC_DEFINE([HAVE_LDEXPL_IN_LIBC], [1],
[Define if the ldexpl function is available in libc.])
fi
+ AC_CHECK_FUNCS([nl_langinfo])
])