~ubuntu-branches/ubuntu/trusty/diffutils/trusty-proposed

« back to all changes in this revision

Viewing changes to m4/mbsrtowcs.m4

  • Committer: Bazaar Package Importer
  • Author(s): Santiago Vila
  • Date: 2010-02-13 11:49:00 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20100213114900-09lz8jx6wct52qp8
Tags: 1:2.9-1
* New upstream release, now under GPL version 3 or later.
* There is now a --tab-size option. Closes: #82923.
* Manpage for cmp describes exit status. Closes: #200614.
* Manpage for diff describes exit status. Closes: #228441, #473233.
* The file de.po is now more recent. Closes: #313686.
* Fixed bad sdiff behaviour. Closes: #320222.
* Added wdiff to Suggests. Closes: #324627.
* Fixed cmp behaviour regarding stdout and stderr. Closes: #356083.
* The file ru.po is now more recent. Closes: #409274.
* The file es.po is now more recent. Closes: #418005, #481708.
* The file nl.po is now more recent. Closes: #427370.
* Modified watch file to use http instead of ftp.
* Removed .comment section from executables.
* Added Homepage field to control file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# mbsrtowcs.m4 serial 5
 
2
dnl Copyright (C) 2008-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.
 
6
 
 
7
AC_DEFUN([gl_FUNC_MBSRTOWCS],
 
8
[
 
9
  AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
 
10
 
 
11
  AC_REQUIRE([AC_TYPE_MBSTATE_T])
 
12
  gl_MBSTATE_T_BROKEN
 
13
  if test $REPLACE_MBSTATE_T = 1; then
 
14
    REPLACE_MBSRTOWCS=1
 
15
  fi
 
16
  AC_CHECK_FUNCS_ONCE([mbsrtowcs])
 
17
  if test $ac_cv_func_mbsrtowcs = no; then
 
18
    HAVE_MBSRTOWCS=0
 
19
  fi
 
20
  if test $HAVE_MBSRTOWCS != 0 && test $REPLACE_MBSRTOWCS != 1; then
 
21
    gl_MBSRTOWCS_WORKS
 
22
    case "$gl_cv_func_mbsrtowcs_works" in
 
23
      *yes) ;;
 
24
      *) REPLACE_MBSRTOWCS=1 ;;
 
25
    esac
 
26
  fi
 
27
  if test $HAVE_MBSRTOWCS = 0 || test $REPLACE_MBSRTOWCS = 1; then
 
28
    gl_REPLACE_WCHAR_H
 
29
    AC_LIBOBJ([mbsrtowcs])
 
30
    AC_LIBOBJ([mbsrtowcs-state])
 
31
    gl_PREREQ_MBSRTOWCS
 
32
  fi
 
33
])
 
34
 
 
35
dnl Test whether mbsrtowcs works.
 
36
dnl Result is gl_cv_func_mbsrtowcs_works.
 
37
 
 
38
AC_DEFUN([gl_MBSRTOWCS_WORKS],
 
39
[
 
40
  AC_REQUIRE([AC_PROG_CC])
 
41
  AC_REQUIRE([gt_LOCALE_FR_UTF8])
 
42
  AC_REQUIRE([gt_LOCALE_JA])
 
43
  AC_REQUIRE([gt_LOCALE_ZH_CN])
 
44
  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
 
45
  AC_CACHE_CHECK([whether mbsrtowcs works],
 
46
    [gl_cv_func_mbsrtowcs_works],
 
47
    [
 
48
      dnl Initial guess, used when cross-compiling or when no suitable locale
 
49
      dnl is present.
 
50
changequote(,)dnl
 
51
      case "$host_os" in
 
52
                          # Guess no on HP-UX and Solaris.
 
53
        hpux* | solaris*) gl_cv_func_mbsrtowcs_works="guessing no" ;;
 
54
                          # Guess yes otherwise.
 
55
        *)                gl_cv_func_mbsrtowcs_works="guessing yes" ;;
 
56
      esac
 
57
changequote([,])dnl
 
58
      if test $LOCALE_FR_UTF8 != none || test $LOCALE_JA != none || test $LOCALE_ZH_CN != none; then
 
59
        AC_TRY_RUN([
 
60
#include <locale.h>
 
61
#include <string.h>
 
62
#include <wchar.h>
 
63
int main ()
 
64
{
 
65
  /* Test whether the function works when started with a conversion state
 
66
     in non-initial state.  This fails on HP-UX 11.11 and Solaris 10.  */
 
67
  if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL)
 
68
    {
 
69
      const char input[] = "B\303\274\303\237er";
 
70
      mbstate_t state;
 
71
 
 
72
      memset (&state, '\0', sizeof (mbstate_t));
 
73
      if (mbrtowc (NULL, input + 1, 1, &state) == (size_t)(-2))
 
74
        if (!mbsinit (&state))
 
75
          {
 
76
            const char *src = input + 2;
 
77
            if (mbsrtowcs (NULL, &src, 10, &state) != 4)
 
78
              return 1;
 
79
          }
 
80
    }
 
81
  if (setlocale (LC_ALL, "$LOCALE_JA") != NULL)
 
82
    {
 
83
      const char input[] = "<\306\374\313\334\270\354>";
 
84
      mbstate_t state;
 
85
 
 
86
      memset (&state, '\0', sizeof (mbstate_t));
 
87
      if (mbrtowc (NULL, input + 3, 1, &state) == (size_t)(-2))
 
88
        if (!mbsinit (&state))
 
89
          {
 
90
            const char *src = input + 4;
 
91
            if (mbsrtowcs (NULL, &src, 10, &state) != 3)
 
92
              return 1;
 
93
          }
 
94
    }
 
95
  if (setlocale (LC_ALL, "$LOCALE_ZH_CN") != NULL)
 
96
    {
 
97
      const char input[] = "B\250\271\201\060\211\070er";
 
98
      mbstate_t state;
 
99
 
 
100
      memset (&state, '\0', sizeof (mbstate_t));
 
101
      if (mbrtowc (NULL, input + 1, 1, &state) == (size_t)(-2))
 
102
        if (!mbsinit (&state))
 
103
          {
 
104
            const char *src = input + 2;
 
105
            if (mbsrtowcs (NULL, &src, 10, &state) != 4)
 
106
              return 1;
 
107
          }
 
108
    }
 
109
  return 0;
 
110
}],
 
111
          [gl_cv_func_mbsrtowcs_works=yes],
 
112
          [gl_cv_func_mbsrtowcs_works=no],
 
113
          [:])
 
114
      fi
 
115
    ])
 
116
])
 
117
 
 
118
# Prerequisites of lib/mbsrtowcs.c.
 
119
AC_DEFUN([gl_PREREQ_MBSRTOWCS], [
 
120
  :
 
121
])