Add an entertaining `procedure->pointer' test.
[bpt/guile.git] / m4 / duplocale.m4
CommitLineData
f4c79b3c 1# duplocale.m4 serial 2
61cd9dc9 2dnl Copyright (C) 2009, 2010 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>.
15 AC_REQUIRE([gl_LOCALE_H])
16 AC_CACHE_CHECK([whether duplocale(LC_GLOBAL_LOCALE) works],
17 [gl_cv_func_duplocale_works],
18 [AC_TRY_RUN([
19#include <locale.h>
20#if HAVE_XLOCALE_H
21# include <xlocale.h>
22#endif
23int main ()
24{
25 (void) duplocale (LC_GLOBAL_LOCALE);
26 return 0;
27}], [gl_cv_func_duplocale_works=yes], [gl_cv_func_duplocale_works=no],
28 [dnl Guess it works except on glibc < 2.12.
29 AC_EGREP_CPP([Unlucky GNU user], [
30#include <features.h>
31#ifdef __GNU_LIBRARY__
32 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ < 12)
33 Unlucky GNU user
34 #endif
35#endif
36 ],
37 [gl_cv_func_duplocale_works="guessing no"],
38 [gl_cv_func_duplocale_works="guessing yes"])
39 ])
40 ])
41 case "$gl_cv_func_duplocale_works" in
42 *no) REPLACE_DUPLOCALE=1 ;;
43 esac
f4c79b3c
LC
44 else
45 HAVE_DUPLOCALE=0
c3b16a5d
LC
46 fi
47 if test $REPLACE_DUPLOCALE = 1; then
48 gl_REPLACE_LOCALE_H
49 AC_LIBOBJ([duplocale])
50 gl_PREREQ_DUPLOCALE
51 fi
52])
53
54# Prerequisites of lib/duplocale.c.
55AC_DEFUN([gl_PREREQ_DUPLOCALE],
56[
57 :
58])