Debian Codegraph @

m4/localeconv.m4

raw
1 # localeconv.m4
2 # serial 3
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.
7 dnl This file is offered as-is, without any warranty.
8
9 AC_DEFUN([gl_FUNC_LOCALECONV],
10 [
11 AC_REQUIRE([gl_LOCALE_H_DEFAULTS])
12 AC_REQUIRE([gl_LOCALE_H])
13 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
14
15 if test $REPLACE_STRUCT_LCONV = 1; then
16 REPLACE_LOCALECONV=1
17 fi
18 if test $REPLACE_LOCALECONV = 0; then
19 dnl Test whether fields of type 'char' are filled correctly.
20 dnl This test fails on mingw 5.0.3.
21 AC_CACHE_CHECK([whether localeconv works],
22 [gl_cv_func_localeconv_works],
23 [AC_RUN_IFELSE(
24 [AC_LANG_SOURCE([[
25 #include <locale.h>
26 #include <limits.h>
27 int main ()
28 {
29 struct lconv *l = localeconv ();
30 return l->frac_digits != CHAR_MAX && l->frac_digits < 0;
31 }
32 ]])],
33 [gl_cv_func_localeconv_works=yes],
34 [gl_cv_func_localeconv_works=no],
35 [case "$host_os" in
36 # Guess yes on glibc systems.
37 *-gnu* | gnu*) gl_cv_func_localeconv_works="guessing yes" ;;
38 # Guess yes on musl systems.
39 *-musl* | midipix*) gl_cv_func_localeconv_works="guessing yes" ;;
40 # Guess no on native Windows.
41 mingw* | windows*) gl_cv_func_localeconv_works="guessing no" ;;
42 # If we don't know, obey --enable-cross-guesses.
43 *) gl_cv_func_localeconv_works="$gl_cross_guess_normal" ;;
44 esac
45 ])
46 ])
47 case "$gl_cv_func_localeconv_works" in
48 *yes) ;;
49 *) REPLACE_LOCALECONV=1 ;;
50 esac
51 fi
52 ])
53
54 # Prerequisites of lib/localeconv.c.
55 AC_DEFUN([gl_PREREQ_LOCALECONV],
56 [
57 AC_CHECK_MEMBERS([struct lconv.decimal_point], [], [],
58 [[#include <locale.h>]])
59 AC_CHECK_MEMBERS([struct lconv.int_p_cs_precedes], [], [],
60 [[#include <locale.h>]])
61 ])