~peter-pearse/ubuntu/natty/diffutils/prop001

« back to all changes in this revision

Viewing changes to m4/btowc.m4

  • Committer: Bazaar Package Importer
  • Author(s): Santiago Vila
  • Date: 2010-05-04 20:38:00 UTC
  • mfrom: (2.1.7 sid)
  • Revision ID: james.westby@ubuntu.com-20100504203800-f67xd9rsa9xl9qqj
Tags: 1:3.0-1
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# btowc.m4 serial 6
 
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_BTOWC],
 
8
[
 
9
  AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
 
10
 
 
11
  dnl Check whether <wchar.h> is usable at all, first. Otherwise the test
 
12
  dnl program below may lead to an endless loop. See
 
13
  dnl <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42440>.
 
14
  AC_REQUIRE([gl_WCHAR_H_INLINE_OK])
 
15
 
 
16
  AC_CHECK_FUNCS_ONCE([btowc])
 
17
  if test $ac_cv_func_btowc = no; then
 
18
    HAVE_BTOWC=0
 
19
  else
 
20
 
 
21
    AC_REQUIRE([AC_PROG_CC])
 
22
    AC_REQUIRE([gt_LOCALE_FR])
 
23
    AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
 
24
 
 
25
    dnl Cygwin 1.7.2 btowc('\0') is WEOF, not 0.
 
26
    AC_CACHE_CHECK([whether btowc(0) is correct],
 
27
      [gl_cv_func_btowc_nul],
 
28
      [
 
29
        AC_TRY_RUN([
 
30
#include <stdio.h>
 
31
#include <string.h>
 
32
#include <wchar.h>
 
33
int main ()
 
34
{
 
35
  if (btowc ('\0') != 0)
 
36
    return 1;
 
37
  return 0;
 
38
}],
 
39
          [gl_cv_func_btowc_nul=yes],
 
40
          [gl_cv_func_btowc_nul=no],
 
41
          [
 
42
changequote(,)dnl
 
43
           case "$host_os" in
 
44
                      # Guess no on Cygwin.
 
45
             cygwin*) gl_cv_func_btowc_nul="guessing no" ;;
 
46
                      # Guess yes otherwise.
 
47
             *)       gl_cv_func_btowc_nul="guessing yes" ;;
 
48
           esac
 
49
changequote([,])dnl
 
50
          ])
 
51
      ])
 
52
 
 
53
    dnl IRIX 6.5 btowc(EOF) is 0xFF, not WEOF.
 
54
    AC_CACHE_CHECK([whether btowc(EOF) is correct],
 
55
      [gl_cv_func_btowc_eof],
 
56
      [
 
57
        dnl Initial guess, used when cross-compiling or when no suitable locale
 
58
        dnl is present.
 
59
changequote(,)dnl
 
60
        case "$host_os" in
 
61
                 # Guess no on IRIX.
 
62
          irix*) gl_cv_func_btowc_eof="guessing no" ;;
 
63
                 # Guess yes otherwise.
 
64
          *)     gl_cv_func_btowc_eof="guessing yes" ;;
 
65
        esac
 
66
changequote([,])dnl
 
67
        if test $LOCALE_FR != none; then
 
68
          AC_TRY_RUN([
 
69
#include <locale.h>
 
70
#include <stdio.h>
 
71
#include <string.h>
 
72
#include <wchar.h>
 
73
int main ()
 
74
{
 
75
  if (setlocale (LC_ALL, "$LOCALE_FR") != NULL)
 
76
    {
 
77
      if (btowc (EOF) != WEOF)
 
78
        return 1;
 
79
    }
 
80
  return 0;
 
81
}],
 
82
            [gl_cv_func_btowc_eof=yes],
 
83
            [gl_cv_func_btowc_eof=no],
 
84
            [:])
 
85
        fi
 
86
      ])
 
87
 
 
88
    case "$gl_cv_func_btowc_nul" in
 
89
      *yes) ;;
 
90
      *) REPLACE_BTOWC=1 ;;
 
91
    esac
 
92
    case "$gl_cv_func_btowc_eof" in
 
93
      *yes) ;;
 
94
      *) REPLACE_BTOWC=1 ;;
 
95
    esac
 
96
  fi
 
97
  if test $HAVE_BTOWC = 0 || test $REPLACE_BTOWC = 1; then
 
98
    gl_REPLACE_WCHAR_H
 
99
    AC_LIBOBJ([btowc])
 
100
    gl_PREREQ_BTOWC
 
101
  fi
 
102
])
 
103
 
 
104
# Prerequisites of lib/btowc.c.
 
105
AC_DEFUN([gl_PREREQ_BTOWC], [
 
106
  :
 
107
])