~ubuntu-branches/ubuntu/trusty/gettext/trusty

« back to all changes in this revision

Viewing changes to gettext-tools/gnulib-m4/mbsrtowcs.m4

  • Committer: Package Import Robot
  • Author(s): Matthias Klose
  • Date: 2013-10-21 19:12:18 UTC
  • mfrom: (2.1.22 sid)
  • Revision ID: package-import@ubuntu.com-20131021191218-5t1ixdaae0dbc1l3
Tags: 0.18.3.1-1ubuntu1
* Merge with Debian; remaining changes:
  - Allow the package to cross-build.
  - Define a stage1 profile to build without java and git.
  - Throw away /usr/lib/gettext/gnu.gettext*; we don't need them.
  - Explicitly configure with --disable-csharp.
  - Keep gettext.jar in /usr/share/gettext instead of moving it to
    /usr/share/java.
  - Drop autopoint recommends of gettext. It pulls in git and
    other sizable packages which make the CDs explode.
* gettext-el: Add an alternative dependency on emacs24.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# mbsrtowcs.m4 serial 6
2
 
dnl Copyright (C) 2008-2010 Free Software Foundation, Inc.
 
1
# mbsrtowcs.m4 serial 13
 
2
dnl Copyright (C) 2008-2013 Free Software Foundation, Inc.
3
3
dnl This file is free software; the Free Software Foundation
4
4
dnl gives unlimited permission to copy and/or distribute it,
5
5
dnl with or without modifications, as long as this notice is preserved.
14
14
  AC_CHECK_FUNCS_ONCE([mbsrtowcs])
15
15
  if test $ac_cv_func_mbsrtowcs = no; then
16
16
    HAVE_MBSRTOWCS=0
 
17
    AC_CHECK_DECLS([mbsrtowcs],,, [[
 
18
/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
 
19
   <wchar.h>.
 
20
   BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
 
21
   included before <wchar.h>.  */
 
22
#include <stddef.h>
 
23
#include <stdio.h>
 
24
#include <time.h>
 
25
#include <wchar.h>
 
26
]])
 
27
    if test $ac_cv_have_decl_mbsrtowcs = yes; then
 
28
      dnl On Minix 3.1.8, the system's <wchar.h> declares mbsrtowcs() although
 
29
      dnl it does not have the function. Avoid a collision with gnulib's
 
30
      dnl replacement.
 
31
      REPLACE_MBSRTOWCS=1
 
32
    fi
17
33
  else
18
34
    if test $REPLACE_MBSTATE_T = 1; then
19
35
      REPLACE_MBSRTOWCS=1
25
41
      esac
26
42
    fi
27
43
  fi
28
 
  if test $HAVE_MBSRTOWCS = 0 || test $REPLACE_MBSRTOWCS = 1; then
29
 
    gl_REPLACE_WCHAR_H
30
 
    AC_LIBOBJ([mbsrtowcs])
31
 
    AC_LIBOBJ([mbsrtowcs-state])
32
 
    gl_PREREQ_MBSRTOWCS
33
 
  fi
34
44
])
35
45
 
36
46
dnl Test whether mbsrtowcs works.
39
49
AC_DEFUN([gl_MBSRTOWCS_WORKS],
40
50
[
41
51
  AC_REQUIRE([AC_PROG_CC])
 
52
  AC_REQUIRE([gt_LOCALE_FR])
42
53
  AC_REQUIRE([gt_LOCALE_FR_UTF8])
43
54
  AC_REQUIRE([gt_LOCALE_JA])
44
55
  AC_REQUIRE([gt_LOCALE_ZH_CN])
50
61
      dnl is present.
51
62
changequote(,)dnl
52
63
      case "$host_os" in
53
 
                          # Guess no on HP-UX and Solaris.
54
 
        hpux* | solaris*) gl_cv_func_mbsrtowcs_works="guessing no" ;;
55
 
                          # Guess yes otherwise.
56
 
        *)                gl_cv_func_mbsrtowcs_works="guessing yes" ;;
 
64
                                   # Guess no on HP-UX, Solaris, mingw.
 
65
        hpux* | solaris* | mingw*) gl_cv_func_mbsrtowcs_works="guessing no" ;;
 
66
                                   # Guess yes otherwise.
 
67
        *)                         gl_cv_func_mbsrtowcs_works="guessing yes" ;;
57
68
      esac
58
69
changequote([,])dnl
59
 
      if test $LOCALE_FR_UTF8 != none || test $LOCALE_JA != none || test $LOCALE_ZH_CN != none; then
60
 
        AC_TRY_RUN([
 
70
      if test $LOCALE_FR != none || test $LOCALE_FR_UTF8 != none || test $LOCALE_JA != none || test $LOCALE_ZH_CN != none; then
 
71
        AC_RUN_IFELSE(
 
72
          [AC_LANG_SOURCE([[
61
73
#include <locale.h>
62
74
#include <string.h>
 
75
/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
 
76
   <wchar.h>.
 
77
   BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
 
78
   included before <wchar.h>.  */
 
79
#include <stddef.h>
 
80
#include <stdio.h>
 
81
#include <time.h>
63
82
#include <wchar.h>
64
83
int main ()
65
84
{
 
85
  int result = 0;
 
86
  /* Test whether the function supports a NULL destination argument.
 
87
     This fails on native Windows.  */
 
88
  if (setlocale (LC_ALL, "$LOCALE_FR") != NULL)
 
89
    {
 
90
      const char input[] = "\337er";
 
91
      const char *src = input;
 
92
      mbstate_t state;
 
93
 
 
94
      memset (&state, '\0', sizeof (mbstate_t));
 
95
      if (mbsrtowcs (NULL, &src, 1, &state) != 3
 
96
          || src != input)
 
97
        result |= 1;
 
98
    }
66
99
  /* Test whether the function works when started with a conversion state
67
100
     in non-initial state.  This fails on HP-UX 11.11 and Solaris 10.  */
68
101
  if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL)
76
109
          {
77
110
            const char *src = input + 2;
78
111
            if (mbsrtowcs (NULL, &src, 10, &state) != 4)
79
 
              return 1;
 
112
              result |= 2;
80
113
          }
81
114
    }
82
115
  if (setlocale (LC_ALL, "$LOCALE_JA") != NULL)
90
123
          {
91
124
            const char *src = input + 4;
92
125
            if (mbsrtowcs (NULL, &src, 10, &state) != 3)
93
 
              return 1;
 
126
              result |= 4;
94
127
          }
95
128
    }
96
129
  if (setlocale (LC_ALL, "$LOCALE_ZH_CN") != NULL)
104
137
          {
105
138
            const char *src = input + 2;
106
139
            if (mbsrtowcs (NULL, &src, 10, &state) != 4)
107
 
              return 1;
 
140
              result |= 8;
108
141
          }
109
142
    }
110
 
  return 0;
111
 
}],
 
143
  return result;
 
144
}]])],
112
145
          [gl_cv_func_mbsrtowcs_works=yes],
113
146
          [gl_cv_func_mbsrtowcs_works=no],
114
147
          [:])