1 # langinfo_h.m4 serial 7
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 dnl <langinfo.h> is always overridden, because of GNULIB_POSIXCHECK.
15 gl_CHECK_NEXT_HEADERS([langinfo.h])
17 dnl Determine whether <langinfo.h> exists. It is missing on mingw and BeOS.
18 HAVE_LANGINFO_CODESET=0
20 AC_CHECK_HEADERS_ONCE([langinfo.h])
21 if test $ac_cv_header_langinfo_h = yes; then
23 dnl Determine what <langinfo.h> defines. CODESET and ERA etc. are missing
24 dnl on OpenBSD 3.8. T_FMT_AMPM an YESEXPR, NOEXPR are missing on IRIX 5.3.
25 AC_CACHE_CHECK([whether langinfo.h defines CODESET],
26 [gl_cv_header_langinfo_codeset],
28 [AC_LANG_PROGRAM([[#include <langinfo.h>
31 [gl_cv_header_langinfo_codeset=yes],
32 [gl_cv_header_langinfo_codeset=no])
34 if test $gl_cv_header_langinfo_codeset = yes; then
35 HAVE_LANGINFO_CODESET=1
37 AC_CACHE_CHECK([whether langinfo.h defines T_FMT_AMPM],
38 [gl_cv_header_langinfo_t_fmt_ampm],
40 [AC_LANG_PROGRAM([[#include <langinfo.h>
43 [gl_cv_header_langinfo_t_fmt_ampm=yes],
44 [gl_cv_header_langinfo_t_fmt_ampm=no])
46 if test $gl_cv_header_langinfo_t_fmt_ampm = yes; then
47 HAVE_LANGINFO_T_FMT_AMPM=1
49 AC_CACHE_CHECK([whether langinfo.h defines ERA],
50 [gl_cv_header_langinfo_era],
52 [AC_LANG_PROGRAM([[#include <langinfo.h>
55 [gl_cv_header_langinfo_era=yes],
56 [gl_cv_header_langinfo_era=no])
58 if test $gl_cv_header_langinfo_era = yes; then
61 AC_CACHE_CHECK([whether langinfo.h defines YESEXPR],
62 [gl_cv_header_langinfo_yesexpr],
64 [AC_LANG_PROGRAM([[#include <langinfo.h>
67 [gl_cv_header_langinfo_yesexpr=yes],
68 [gl_cv_header_langinfo_yesexpr=no])
70 if test $gl_cv_header_langinfo_yesexpr = yes; then
71 HAVE_LANGINFO_YESEXPR=1
76 AC_SUBST([HAVE_LANGINFO_H])
77 AC_SUBST([HAVE_LANGINFO_CODESET])
78 AC_SUBST([HAVE_LANGINFO_T_FMT_AMPM])
79 AC_SUBST([HAVE_LANGINFO_ERA])
80 AC_SUBST([HAVE_LANGINFO_YESEXPR])
82 dnl Check for declarations of anything we want to poison if the
83 dnl corresponding gnulib module is not in use.
84 gl_WARN_ON_USE_PREPARE([[#include <langinfo.h>
88 AC_DEFUN([gl_LANGINFO_MODULE_INDICATOR],
90 dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
91 AC_REQUIRE([gl_LANGINFO_H_DEFAULTS])
92 gl_MODULE_INDICATOR_SET_VARIABLE([$1])
93 dnl Define it also as a C macro, for the benefit of the unit tests.
94 gl_MODULE_INDICATOR_FOR_TESTS([$1])
97 AC_DEFUN([gl_LANGINFO_H_DEFAULTS],
99 GNULIB_NL_LANGINFO=0; AC_SUBST([GNULIB_NL_LANGINFO])
100 dnl Assume proper GNU behavior unless another module says otherwise.
101 HAVE_NL_LANGINFO=1; AC_SUBST([HAVE_NL_LANGINFO])
102 REPLACE_NL_LANGINFO=0; AC_SUBST([REPLACE_NL_LANGINFO])