Import 'copysign' and 'isfinite' modules from Gnulib.
[bpt/guile.git] / m4 / duplocale.m4
CommitLineData
3d458a81 1# duplocale.m4 serial 7
af07e104 2dnl Copyright (C) 2009-2013 Free Software Foundation, Inc.
c3b16a5d
LC
3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved.
6
7AC_DEFUN([gl_FUNC_DUPLOCALE],
8[
9 AC_REQUIRE([gl_LOCALE_H_DEFAULTS])
10 AC_REQUIRE([AC_CANONICAL_HOST])
11 AC_CHECK_FUNCS_ONCE([duplocale])
12 if test $ac_cv_func_duplocale = yes; then
13 dnl Check against glibc bug where duplocale crashes.
14 dnl See <http://sourceware.org/bugzilla/show_bug.cgi?id=10969>.
9157d901
LC
15 dnl Also, on AIX 7.1, duplocale(LC_GLOBAL_LOCALE) returns (locale_t)0 with
16 dnl errno set to EINVAL.
c3b16a5d
LC
17 AC_REQUIRE([gl_LOCALE_H])
18 AC_CACHE_CHECK([whether duplocale(LC_GLOBAL_LOCALE) works],
19 [gl_cv_func_duplocale_works],
9157d901
LC
20 [AC_RUN_IFELSE(
21 [AC_LANG_SOURCE([[
c3b16a5d
LC
22#include <locale.h>
23#if HAVE_XLOCALE_H
24# include <xlocale.h>
25#endif
26int main ()
27{
9157d901
LC
28 if (duplocale (LC_GLOBAL_LOCALE) == (locale_t)0)
29 return 1;
c3b16a5d 30 return 0;
9157d901
LC
31}]])],
32 [gl_cv_func_duplocale_works=yes],
33 [gl_cv_func_duplocale_works=no],
0f00f2c3 34 [dnl Guess it works except on glibc < 2.12, uClibc, and AIX.
9157d901
LC
35 case "$host_os" in
36 aix*) gl_cv_func_duplocale_works="guessing no";;
37 *-gnu*)
0f00f2c3 38 AC_EGREP_CPP([Unlucky], [
c3b16a5d
LC
39#include <features.h>
40#ifdef __GNU_LIBRARY__
41 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ < 12)
42 Unlucky GNU user
43 #endif
0f00f2c3
LC
44#endif
45#ifdef __UCLIBC__
46 Unlucky user
c3b16a5d 47#endif
9157d901
LC
48 ],
49 [gl_cv_func_duplocale_works="guessing no"],
50 [gl_cv_func_duplocale_works="guessing yes"])
51 ;;
52 *) gl_cv_func_duplocale_works="guessing yes";;
53 esac
c3b16a5d
LC
54 ])
55 ])
56 case "$gl_cv_func_duplocale_works" in
57 *no) REPLACE_DUPLOCALE=1 ;;
58 esac
f4c79b3c
LC
59 else
60 HAVE_DUPLOCALE=0
c3b16a5d 61 fi
c3b16a5d
LC
62])
63
64# Prerequisites of lib/duplocale.c.
65AC_DEFUN([gl_PREREQ_DUPLOCALE],
66[
67 :
68])