3 dnl Copyright (C) 2012-2024 Free Software Foundation, Inc.
4 dnl This file is free software; the Free Software Foundation
5 dnl gives unlimited permission to copy and/or distribute it,
6 dnl with or without modifications, as long as this notice is preserved.
8 AC_DEFUN([gl_FUNC_LOCALECONV],
10 AC_REQUIRE([gl_LOCALE_H_DEFAULTS])
11 AC_REQUIRE([gl_LOCALE_H])
12 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
14 if test $REPLACE_STRUCT_LCONV = 1; then
17 if test $REPLACE_LOCALECONV = 0; then
18 dnl Test whether fields of type 'char' are filled correctly.
19 dnl This test fails on mingw 5.0.3.
20 AC_CACHE_CHECK([whether localeconv works],
21 [gl_cv_func_localeconv_works],
28 struct lconv *l = localeconv ();
29 return l->frac_digits != CHAR_MAX && l->frac_digits < 0;
32 [gl_cv_func_localeconv_works=yes],
33 [gl_cv_func_localeconv_works=no],
35 # Guess yes on glibc systems.
36 *-gnu* | gnu*) gl_cv_func_localeconv_works="guessing yes" ;;
37 # Guess yes on musl systems.
38 *-musl* | midipix*) gl_cv_func_localeconv_works="guessing yes" ;;
39 # Guess no on native Windows.
40 mingw* | windows*) gl_cv_func_localeconv_works="guessing no" ;;
41 # If we don't know, obey --enable-cross-guesses.
42 *) gl_cv_func_localeconv_works="$gl_cross_guess_normal" ;;
46 case "$gl_cv_func_localeconv_works" in
48 *) REPLACE_LOCALECONV=1 ;;
53 # Prerequisites of lib/localeconv.c.
54 AC_DEFUN([gl_PREREQ_LOCALECONV],
56 AC_CHECK_MEMBERS([struct lconv.decimal_point], [], [],
57 [[#include <locale.h>]])
58 AC_CHECK_MEMBERS([struct lconv.int_p_cs_precedes], [], [],
59 [[#include <locale.h>]])