summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorEric Engestrom <eric.engestrom@imgtec.com>2017-08-31 16:55:56 +0000
committerEric Engestrom <eric@engestrom.ch>2017-09-03 09:05:23 +0100
commit49b428470e28ae6ab22083e43fa41abf622f3b0d (patch)
tree55306089b636b316b76a0b6c3d2ddc1c96f574d3 /configure.ac
parent8514c5d0781e4e25669a2cd3bf8a547016b299a2 (diff)
util: improve compiler guard
Glibc 2.26 has dropped xlocale.h, but the functions needed (strtod_l() and strdof_l()) can be found in stdlib.h. Improve the detection method to allow newer builds to still make use of the locale-setting. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=102454 Cc: Laurent Carlier <lordheavym@gmail.com> Cc: Emil Velikov <emil.l.velikov@gmail.com> Cc: Rob Herring <robh@kernel.org> Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com> Reviewed-by: Laurent Carlier <lordheavym@gmail.com> Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac21
1 files changed, 21 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index ac64a38d43..fb6037eedc 100644
--- a/configure.ac
+++ b/configure.ac
@@ -795,6 +795,27 @@ AC_CHECK_HEADER([sys/sysctl.h], [DEFINES="$DEFINES -DHAVE_SYS_SYSCTL_H"])
AC_CHECK_FUNC([strtof], [DEFINES="$DEFINES -DHAVE_STRTOF"])
AC_CHECK_FUNC([mkostemp], [DEFINES="$DEFINES -DHAVE_MKOSTEMP"])
+AC_MSG_CHECKING([whether strtod has locale support])
+AC_LINK_IFELSE([AC_LANG_SOURCE([[
+ #define _GNU_SOURCE
+ #include <stdlib.h>
+ #include <locale.h>
+ #ifdef HAVE_XLOCALE_H
+ #include <xlocale.h>
+ #endif
+ int main() {
+ locale_t loc = newlocale(LC_CTYPE_MASK, "C", NULL);
+ const char *s = "1.0";
+ char *end;
+ double d = strtod_l(s, end, loc);
+ float f = strtof_l(s, end, loc);
+ freelocale(loc);
+ return 0;
+ }]])],
+ [DEFINES="$DEFINES -DHAVE_STRTOD_L"];
+ AC_MSG_RESULT([yes]),
+ AC_MSG_RESULT([no]))
+
dnl Check to see if dlopen is in default libraries (like Solaris, which
dnl has it in libc), or if libdl is needed to get it.
AC_CHECK_FUNC([dlopen], [DEFINES="$DEFINES -DHAVE_DLOPEN"],