]> git.ipfire.org Git - thirdparty/json-c.git/commitdiff
configure.ac: check for `uselocale` function only on Linux platforms
authorAlexandru Ardelean <ardeleanalex@gmail.com>
Thu, 13 Jul 2017 06:33:39 +0000 (09:33 +0300)
committerAlexandru Ardelean <ardeleanalex@gmail.com>
Thu, 13 Jul 2017 06:33:42 +0000 (09:33 +0300)
On Apple this seems to fail the `test_locale` test,
which would imply that the `uselocale` function
does not behave as expected.

Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
configure.ac

index 3a2779e35fdc7a1640ec158ec2ed85afd11ff476..bbaacf51964c1bf29d779603df02f6b60d49aef3 100644 (file)
@@ -7,6 +7,8 @@ AM_INIT_AUTOMAKE
 
 AC_PROG_MAKE_SET
 
+AC_CANONICAL_HOST
+
 AC_ARG_ENABLE(rdrand,
  AS_HELP_STRING([--enable-rdrand],
    [Enable RDRAND Hardware RNG Hash Seed generation on supported x86/x64 platforms.]),
@@ -57,7 +59,7 @@ AS_IF([test "x$ac_cv___thread" != xno],
 AC_FUNC_VPRINTF
 AC_FUNC_MEMCMP
 AC_CHECK_FUNCS([realloc])
-AC_CHECK_FUNCS(strcasecmp strdup strerror snprintf vsnprintf vasprintf open vsyslog strncasecmp setlocale uselocale)
+AC_CHECK_FUNCS(strcasecmp strdup strerror snprintf vsnprintf vasprintf open vsyslog strncasecmp setlocale)
 AC_CHECK_DECLS([INFINITY], [], [], [[#include <math.h>]])
 AC_CHECK_DECLS([nan], [], [], [[#include <math.h>]])
 AC_CHECK_DECLS([isnan], [], [], [[#include <math.h>]])
@@ -65,6 +67,14 @@ AC_CHECK_DECLS([isinf], [], [], [[#include <math.h>]])
 AC_CHECK_DECLS([_isnan], [], [], [[#include <float.h>]])
 AC_CHECK_DECLS([_finite], [], [], [[#include <float.h>]])
 
+case "${host_os}" in
+       linux*)
+               AC_CHECK_FUNCS([uselocale])
+               ;;
+       *)      # Nothing
+               ;;
+esac
+
 if test "$ac_cv_have_decl_isnan" = "yes" ; then
    AC_TRY_LINK([#include <math.h>], [float f = 0.0; return isnan(f)], [], [LIBS="$LIBS -lm"])
 fi