Allow use of --avoid=extensions-aix.
[gnulib.git] / m4 / localeconv.m4
blob77d5684ff08553a7730557c2054ce41e87156a9f
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.
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
15     REPLACE_LOCALECONV=1
16   fi
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],
22       [AC_RUN_IFELSE(
23          [AC_LANG_SOURCE([[
24             #include <locale.h>
25             #include <limits.h>
26             int main ()
27             {
28               struct lconv *l = localeconv ();
29               return l->frac_digits != CHAR_MAX && l->frac_digits < 0;
30             }
31          ]])],
32          [gl_cv_func_localeconv_works=yes],
33          [gl_cv_func_localeconv_works=no],
34          [case "$host_os" in
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" ;;
43           esac
44          ])
45       ])
46     case "$gl_cv_func_localeconv_works" in
47       *yes) ;;
48       *) REPLACE_LOCALECONV=1 ;;
49     esac
50   fi
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>]])