Debian Codegraph @

m4/langinfo_h.m4

raw
1 # langinfo_h.m4 serial 8
2 dnl Copyright (C) 2009-2020 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_LANGINFO_H],
8 [
9 AC_REQUIRE([gl_LANGINFO_H_DEFAULTS])
10
11 dnl Persuade glibc-2.0.6 <langinfo.h> to define CODESET.
12 AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
13
14 dnl <langinfo.h> is always overridden, because of GNULIB_POSIXCHECK.
15 gl_CHECK_NEXT_HEADERS([langinfo.h])
16
17 dnl Determine whether <langinfo.h> exists. It is missing on mingw and BeOS.
18 HAVE_LANGINFO_CODESET=0
19 HAVE_LANGINFO_T_FMT_AMPM=0
20 HAVE_LANGINFO_ALTMON=0
21 HAVE_LANGINFO_ERA=0
22 HAVE_LANGINFO_YESEXPR=0
23 AC_CHECK_HEADERS_ONCE([langinfo.h])
24 if test $ac_cv_header_langinfo_h = yes; then
25 HAVE_LANGINFO_H=1
26 dnl Determine what <langinfo.h> defines. CODESET and ERA etc. are missing
27 dnl on OpenBSD 3.8. T_FMT_AMPM and YESEXPR, NOEXPR are missing on IRIX 5.3.
28 dnl ALTMON_* are missing on glibc 2.26 and many other systems.
29 AC_CACHE_CHECK([whether langinfo.h defines CODESET],
30 [gl_cv_header_langinfo_codeset],
31 [AC_COMPILE_IFELSE(
32 [AC_LANG_PROGRAM([[#include <langinfo.h>
33 int a = CODESET;
34 ]])],
35 [gl_cv_header_langinfo_codeset=yes],
36 [gl_cv_header_langinfo_codeset=no])
37 ])
38 if test $gl_cv_header_langinfo_codeset = yes; then
39 HAVE_LANGINFO_CODESET=1
40 fi
41 AC_CACHE_CHECK([whether langinfo.h defines T_FMT_AMPM],
42 [gl_cv_header_langinfo_t_fmt_ampm],
43 [AC_COMPILE_IFELSE(
44 [AC_LANG_PROGRAM([[#include <langinfo.h>
45 int a = T_FMT_AMPM;
46 ]])],
47 [gl_cv_header_langinfo_t_fmt_ampm=yes],
48 [gl_cv_header_langinfo_t_fmt_ampm=no])
49 ])
50 if test $gl_cv_header_langinfo_t_fmt_ampm = yes; then
51 HAVE_LANGINFO_T_FMT_AMPM=1
52 fi
53 AC_CACHE_CHECK([whether langinfo.h defines ALTMON_1],
54 [gl_cv_header_langinfo_altmon],
55 [AC_COMPILE_IFELSE(
56 [AC_LANG_PROGRAM([[#include <langinfo.h>
57 int a = ALTMON_1;
58 ]])],
59 [gl_cv_header_langinfo_altmon=yes],
60 [gl_cv_header_langinfo_altmon=no])
61 ])
62 if test $gl_cv_header_langinfo_altmon = yes; then
63 HAVE_LANGINFO_ALTMON=1
64 fi
65 AC_CACHE_CHECK([whether langinfo.h defines ERA],
66 [gl_cv_header_langinfo_era],
67 [AC_COMPILE_IFELSE(
68 [AC_LANG_PROGRAM([[#include <langinfo.h>
69 int a = ERA;
70 ]])],
71 [gl_cv_header_langinfo_era=yes],
72 [gl_cv_header_langinfo_era=no])
73 ])
74 if test $gl_cv_header_langinfo_era = yes; then
75 HAVE_LANGINFO_ERA=1
76 fi
77 AC_CACHE_CHECK([whether langinfo.h defines YESEXPR],
78 [gl_cv_header_langinfo_yesexpr],
79 [AC_COMPILE_IFELSE(
80 [AC_LANG_PROGRAM([[#include <langinfo.h>
81 int a = YESEXPR;
82 ]])],
83 [gl_cv_header_langinfo_yesexpr=yes],
84 [gl_cv_header_langinfo_yesexpr=no])
85 ])
86 if test $gl_cv_header_langinfo_yesexpr = yes; then
87 HAVE_LANGINFO_YESEXPR=1
88 fi
89 else
90 HAVE_LANGINFO_H=0
91 fi
92 AC_SUBST([HAVE_LANGINFO_H])
93 AC_SUBST([HAVE_LANGINFO_CODESET])
94 AC_SUBST([HAVE_LANGINFO_T_FMT_AMPM])
95 AC_SUBST([HAVE_LANGINFO_ALTMON])
96 AC_SUBST([HAVE_LANGINFO_ERA])
97 AC_SUBST([HAVE_LANGINFO_YESEXPR])
98
99 dnl Check for declarations of anything we want to poison if the
100 dnl corresponding gnulib module is not in use.
101 gl_WARN_ON_USE_PREPARE([[#include <langinfo.h>
102 ]], [nl_langinfo])
103 ])
104
105 AC_DEFUN([gl_LANGINFO_MODULE_INDICATOR],
106 [
107 dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
108 AC_REQUIRE([gl_LANGINFO_H_DEFAULTS])
109 gl_MODULE_INDICATOR_SET_VARIABLE([$1])
110 dnl Define it also as a C macro, for the benefit of the unit tests.
111 gl_MODULE_INDICATOR_FOR_TESTS([$1])
112 ])
113
114 AC_DEFUN([gl_LANGINFO_H_DEFAULTS],
115 [
116 GNULIB_NL_LANGINFO=0; AC_SUBST([GNULIB_NL_LANGINFO])
117 dnl Assume proper GNU behavior unless another module says otherwise.
118 HAVE_NL_LANGINFO=1; AC_SUBST([HAVE_NL_LANGINFO])
119 REPLACE_NL_LANGINFO=0; AC_SUBST([REPLACE_NL_LANGINFO])
120 ])