diff options
author | Eric Engestrom <[email protected]> | 2017-08-31 16:55:56 +0000 |
---|---|---|
committer | Emil Velikov <[email protected]> | 2017-09-13 21:52:01 +0100 |
commit | 6e2b9fba2138c15b6cc6e8c4076161b3e66dc1b5 (patch) | |
tree | 2809658cc6a3086eaae10e300c10fa9f0bb7e4e2 /configure.ac | |
parent | dcb634df92f9392340eb5d4c718c0552b4e2097e (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 <[email protected]>
Cc: Emil Velikov <[email protected]>
Cc: Rob Herring <[email protected]>
Signed-off-by: Eric Engestrom <[email protected]>
Reviewed-by: Laurent Carlier <[email protected]>
Reviewed-by: Jose Fonseca <[email protected]>
(cherry picked from commit 49b428470e28ae6ab22083e43fa41abf622f3b0d)
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac index 0bd96500c9c..6668256615e 100644 --- a/configure.ac +++ b/configure.ac @@ -826,6 +826,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"], |