~youscribe/parted/3.1

« back to all changes in this revision

Viewing changes to m4/langinfo_h.m4

  • Committer: Guilhem Lettron
  • Date: 2012-10-22 14:37:59 UTC
  • Revision ID: guilhem+ubuntu@lettron.fr-20121022143759-m403kecgz13sknvp
3.1 from tarball

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# langinfo_h.m4 serial 7
 
2
dnl Copyright (C) 2009-2012 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_ERA=0
 
21
  HAVE_LANGINFO_YESEXPR=0
 
22
  AC_CHECK_HEADERS_ONCE([langinfo.h])
 
23
  if test $ac_cv_header_langinfo_h = yes; then
 
24
    HAVE_LANGINFO_H=1
 
25
    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
    AC_CACHE_CHECK([whether langinfo.h defines CODESET],
 
28
      [gl_cv_header_langinfo_codeset],
 
29
      [AC_COMPILE_IFELSE(
 
30
         [AC_LANG_PROGRAM([[#include <langinfo.h>
 
31
int a = CODESET;
 
32
]])],
 
33
         [gl_cv_header_langinfo_codeset=yes],
 
34
         [gl_cv_header_langinfo_codeset=no])
 
35
      ])
 
36
    if test $gl_cv_header_langinfo_codeset = yes; then
 
37
      HAVE_LANGINFO_CODESET=1
 
38
    fi
 
39
    AC_CACHE_CHECK([whether langinfo.h defines T_FMT_AMPM],
 
40
      [gl_cv_header_langinfo_t_fmt_ampm],
 
41
      [AC_COMPILE_IFELSE(
 
42
         [AC_LANG_PROGRAM([[#include <langinfo.h>
 
43
int a = T_FMT_AMPM;
 
44
]])],
 
45
         [gl_cv_header_langinfo_t_fmt_ampm=yes],
 
46
         [gl_cv_header_langinfo_t_fmt_ampm=no])
 
47
      ])
 
48
    if test $gl_cv_header_langinfo_t_fmt_ampm = yes; then
 
49
      HAVE_LANGINFO_T_FMT_AMPM=1
 
50
    fi
 
51
    AC_CACHE_CHECK([whether langinfo.h defines ERA],
 
52
      [gl_cv_header_langinfo_era],
 
53
      [AC_COMPILE_IFELSE(
 
54
         [AC_LANG_PROGRAM([[#include <langinfo.h>
 
55
int a = ERA;
 
56
]])],
 
57
         [gl_cv_header_langinfo_era=yes],
 
58
         [gl_cv_header_langinfo_era=no])
 
59
      ])
 
60
    if test $gl_cv_header_langinfo_era = yes; then
 
61
      HAVE_LANGINFO_ERA=1
 
62
    fi
 
63
    AC_CACHE_CHECK([whether langinfo.h defines YESEXPR],
 
64
      [gl_cv_header_langinfo_yesexpr],
 
65
      [AC_COMPILE_IFELSE(
 
66
         [AC_LANG_PROGRAM([[#include <langinfo.h>
 
67
int a = YESEXPR;
 
68
]])],
 
69
         [gl_cv_header_langinfo_yesexpr=yes],
 
70
         [gl_cv_header_langinfo_yesexpr=no])
 
71
      ])
 
72
    if test $gl_cv_header_langinfo_yesexpr = yes; then
 
73
      HAVE_LANGINFO_YESEXPR=1
 
74
    fi
 
75
  else
 
76
    HAVE_LANGINFO_H=0
 
77
  fi
 
78
  AC_SUBST([HAVE_LANGINFO_H])
 
79
  AC_SUBST([HAVE_LANGINFO_CODESET])
 
80
  AC_SUBST([HAVE_LANGINFO_T_FMT_AMPM])
 
81
  AC_SUBST([HAVE_LANGINFO_ERA])
 
82
  AC_SUBST([HAVE_LANGINFO_YESEXPR])
 
83
 
 
84
  dnl Check for declarations of anything we want to poison if the
 
85
  dnl corresponding gnulib module is not in use.
 
86
  gl_WARN_ON_USE_PREPARE([[#include <langinfo.h>
 
87
    ]], [nl_langinfo])
 
88
])
 
89
 
 
90
AC_DEFUN([gl_LANGINFO_MODULE_INDICATOR],
 
91
[
 
92
  dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
 
93
  AC_REQUIRE([gl_LANGINFO_H_DEFAULTS])
 
94
  gl_MODULE_INDICATOR_SET_VARIABLE([$1])
 
95
  dnl Define it also as a C macro, for the benefit of the unit tests.
 
96
  gl_MODULE_INDICATOR_FOR_TESTS([$1])
 
97
])
 
98
 
 
99
AC_DEFUN([gl_LANGINFO_H_DEFAULTS],
 
100
[
 
101
  GNULIB_NL_LANGINFO=0;  AC_SUBST([GNULIB_NL_LANGINFO])
 
102
  dnl Assume proper GNU behavior unless another module says otherwise.
 
103
  HAVE_NL_LANGINFO=1;    AC_SUBST([HAVE_NL_LANGINFO])
 
104
  REPLACE_NL_LANGINFO=0; AC_SUBST([REPLACE_NL_LANGINFO])
 
105
])