1 # langinfo_h.m4 serial 4
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.
7 AC_DEFUN([gl_LANGINFO_H],
9 AC_REQUIRE([gl_LANGINFO_H_DEFAULTS])
11 dnl Persuade glibc-2.0.6 <langinfo.h> to define CODESET.
12 AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
14 gl_CHECK_NEXT_HEADERS([langinfo.h])
16 dnl Determine whether <langinfo.h> exists. It is missing on mingw and BeOS.
17 HAVE_LANGINFO_CODESET=0
19 AC_CHECK_HEADERS_ONCE([langinfo.h])
20 if test $ac_cv_header_langinfo_h = yes; then
22 dnl Determine what <langinfo.h> defines. CODESET and ERA etc. are missing
24 AC_CACHE_CHECK([whether langinfo.h defines CODESET],
25 [gl_cv_header_langinfo_codeset],
27 [AC_LANG_PROGRAM([[#include <langinfo.h>
30 [gl_cv_header_langinfo_codeset=yes],
31 [gl_cv_header_langinfo_codeset=no])
33 if test $gl_cv_header_langinfo_codeset = yes; then
34 HAVE_LANGINFO_CODESET=1
36 AC_CACHE_CHECK([whether langinfo.h defines ERA],
37 [gl_cv_header_langinfo_era],
39 [AC_LANG_PROGRAM([[#include <langinfo.h>
42 [gl_cv_header_langinfo_era=yes],
43 [gl_cv_header_langinfo_era=no])
45 if test $gl_cv_header_langinfo_era = yes; then
51 AC_SUBST([HAVE_LANGINFO_H])
52 AC_SUBST([HAVE_LANGINFO_CODESET])
53 AC_SUBST([HAVE_LANGINFO_ERA])
55 dnl Check for declarations of anything we want to poison if the
56 dnl corresponding gnulib module is not in use.
57 gl_WARN_ON_USE_PREPARE([[#include <langinfo.h>
61 AC_DEFUN([gl_LANGINFO_MODULE_INDICATOR],
63 dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
64 AC_REQUIRE([gl_LANGINFO_H_DEFAULTS])
65 GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1
66 dnl Define it also as a C macro, for the benefit of the unit tests.
67 gl_MODULE_INDICATOR([$1])
70 AC_DEFUN([gl_LANGINFO_H_DEFAULTS],
72 GNULIB_NL_LANGINFO=0; AC_SUBST([GNULIB_NL_LANGINFO])
73 dnl Assume proper GNU behavior unless another module says otherwise.
74 HAVE_NL_LANGINFO=1; AC_SUBST([HAVE_NL_LANGINFO])
75 REPLACE_NL_LANGINFO=0; AC_SUBST([REPLACE_NL_LANGINFO])