erroneous commas inside @var
[gnulib.git] / m4 / duplocale.m4
1 # duplocale.m4 serial 3
2 dnl Copyright (C) 2009-2010 Free Software Foundation, Inc.
3 dnl This file is free software; the Free Software Foundation
4 dnl gives unlimited permission to copy and/or distribute it,
5 dnl with or without modifications, as long as this notice is preserved.
6
7 AC_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>.
15     dnl Also, on AIX 7.1, duplocale(LC_GLOBAL_LOCALE) returns (locale_t)0 with
16     dnl errno set to EINVAL.
17     AC_REQUIRE([gl_LOCALE_H])
18     AC_CACHE_CHECK([whether duplocale(LC_GLOBAL_LOCALE) works],
19       [gl_cv_func_duplocale_works],
20       [AC_TRY_RUN([
21 #include <locale.h>
22 #if HAVE_XLOCALE_H
23 # include <xlocale.h>
24 #endif
25 int main ()
26 {
27   if (duplocale (LC_GLOBAL_LOCALE) == (locale_t)0)
28     return 1;
29   return 0;
30 }], [gl_cv_func_duplocale_works=yes], [gl_cv_func_duplocale_works=no],
31          [dnl Guess it works except on glibc < 2.12 and AIX.
32           case "$host_os" in
33             aix*) gl_cv_func_duplocale_works="guessing no";;
34             *-gnu*)
35               AC_EGREP_CPP([Unlucky GNU user], [
36 #include <features.h>
37 #ifdef __GNU_LIBRARY__
38  #if (__GLIBC__ == 2 && __GLIBC_MINOR__ < 12)
39   Unlucky GNU user
40  #endif
41 #endif
42                 ],
43                 [gl_cv_func_duplocale_works="guessing no"],
44                 [gl_cv_func_duplocale_works="guessing yes"])
45               ;;
46             *) gl_cv_func_duplocale_works="guessing yes";;
47           esac
48          ])
49       ])
50     case "$gl_cv_func_duplocale_works" in
51       *no) REPLACE_DUPLOCALE=1 ;;
52     esac
53   else
54     HAVE_DUPLOCALE=0
55   fi
56   if test $REPLACE_DUPLOCALE = 1; then
57     gl_REPLACE_LOCALE_H
58     AC_LIBOBJ([duplocale])
59     gl_PREREQ_DUPLOCALE
60   fi
61 ])
62
63 # Prerequisites of lib/duplocale.c.
64 AC_DEFUN([gl_PREREQ_DUPLOCALE],
65 [
66   :
67 ])