comparison m4/langinfo_h.m4 @ 39226:c67645792a3d

langinfo, nl_langinfo: Add support for alternative month names. * m4/langinfo_h.m4 (gl_LANGINFO_H): Define HAVE_LANGINFO_ALTMON. * lib/langinfo.in.h (ALTMON_1...ALTMON_12): New macros. * lib/nl_langinfo.c (rpl_nl_langinfo): Treat ALTMON_i like MON_i. * tests/test-nl_langinfo.c (main): Test ALTMON_*. * doc/posix-headers/langinfo.texi: Document support of ALTMON_*. * doc/posix-functions/nl_langinfo.texi: Likewise.
author Bruno Haible <bruno@clisp.org>
date Wed, 24 Jan 2018 10:02:17 +0100
parents 24e347e0e326
children b06060465f09
comparison
equal deleted inserted replaced
39225:a188a4c517c4 39226:c67645792a3d
1 # langinfo_h.m4 serial 7 1 # langinfo_h.m4 serial 8
2 dnl Copyright (C) 2009-2018 Free Software Foundation, Inc. 2 dnl Copyright (C) 2009-2018 Free Software Foundation, Inc.
3 dnl This file is free software; the Free Software Foundation 3 dnl This file is free software; the Free Software Foundation
4 dnl gives unlimited permission to copy and/or distribute it, 4 dnl gives unlimited permission to copy and/or distribute it,
5 dnl with or without modifications, as long as this notice is preserved. 5 dnl with or without modifications, as long as this notice is preserved.
6 6
15 gl_CHECK_NEXT_HEADERS([langinfo.h]) 15 gl_CHECK_NEXT_HEADERS([langinfo.h])
16 16
17 dnl Determine whether <langinfo.h> exists. It is missing on mingw and BeOS. 17 dnl Determine whether <langinfo.h> exists. It is missing on mingw and BeOS.
18 HAVE_LANGINFO_CODESET=0 18 HAVE_LANGINFO_CODESET=0
19 HAVE_LANGINFO_T_FMT_AMPM=0 19 HAVE_LANGINFO_T_FMT_AMPM=0
20 HAVE_LANGINFO_ALTMON=0
20 HAVE_LANGINFO_ERA=0 21 HAVE_LANGINFO_ERA=0
21 HAVE_LANGINFO_YESEXPR=0 22 HAVE_LANGINFO_YESEXPR=0
22 AC_CHECK_HEADERS_ONCE([langinfo.h]) 23 AC_CHECK_HEADERS_ONCE([langinfo.h])
23 if test $ac_cv_header_langinfo_h = yes; then 24 if test $ac_cv_header_langinfo_h = yes; then
24 HAVE_LANGINFO_H=1 25 HAVE_LANGINFO_H=1
25 dnl Determine what <langinfo.h> defines. CODESET and ERA etc. are missing 26 dnl Determine what <langinfo.h> defines. CODESET and ERA etc. are missing
26 dnl on OpenBSD 3.8. T_FMT_AMPM and YESEXPR, NOEXPR are missing on IRIX 5.3. 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.
27 AC_CACHE_CHECK([whether langinfo.h defines CODESET], 29 AC_CACHE_CHECK([whether langinfo.h defines CODESET],
28 [gl_cv_header_langinfo_codeset], 30 [gl_cv_header_langinfo_codeset],
29 [AC_COMPILE_IFELSE( 31 [AC_COMPILE_IFELSE(
30 [AC_LANG_PROGRAM([[#include <langinfo.h> 32 [AC_LANG_PROGRAM([[#include <langinfo.h>
31 int a = CODESET; 33 int a = CODESET;
45 [gl_cv_header_langinfo_t_fmt_ampm=yes], 47 [gl_cv_header_langinfo_t_fmt_ampm=yes],
46 [gl_cv_header_langinfo_t_fmt_ampm=no]) 48 [gl_cv_header_langinfo_t_fmt_ampm=no])
47 ]) 49 ])
48 if test $gl_cv_header_langinfo_t_fmt_ampm = yes; then 50 if test $gl_cv_header_langinfo_t_fmt_ampm = yes; then
49 HAVE_LANGINFO_T_FMT_AMPM=1 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
50 fi 64 fi
51 AC_CACHE_CHECK([whether langinfo.h defines ERA], 65 AC_CACHE_CHECK([whether langinfo.h defines ERA],
52 [gl_cv_header_langinfo_era], 66 [gl_cv_header_langinfo_era],
53 [AC_COMPILE_IFELSE( 67 [AC_COMPILE_IFELSE(
54 [AC_LANG_PROGRAM([[#include <langinfo.h> 68 [AC_LANG_PROGRAM([[#include <langinfo.h>
76 HAVE_LANGINFO_H=0 90 HAVE_LANGINFO_H=0
77 fi 91 fi
78 AC_SUBST([HAVE_LANGINFO_H]) 92 AC_SUBST([HAVE_LANGINFO_H])
79 AC_SUBST([HAVE_LANGINFO_CODESET]) 93 AC_SUBST([HAVE_LANGINFO_CODESET])
80 AC_SUBST([HAVE_LANGINFO_T_FMT_AMPM]) 94 AC_SUBST([HAVE_LANGINFO_T_FMT_AMPM])
95 AC_SUBST([HAVE_LANGINFO_ALTMON])
81 AC_SUBST([HAVE_LANGINFO_ERA]) 96 AC_SUBST([HAVE_LANGINFO_ERA])
82 AC_SUBST([HAVE_LANGINFO_YESEXPR]) 97 AC_SUBST([HAVE_LANGINFO_YESEXPR])
83 98
84 dnl Check for declarations of anything we want to poison if the 99 dnl Check for declarations of anything we want to poison if the
85 dnl corresponding gnulib module is not in use. 100 dnl corresponding gnulib module is not in use.