Blame gettext-tools/gnulib-m4/mbsinit.m4

Packit Bot 06c835
# mbsinit.m4 serial 8
Packit Bot 06c835
dnl Copyright (C) 2008, 2010-2015 Free Software Foundation, Inc.
Packit Bot 06c835
dnl This file is free software; the Free Software Foundation
Packit Bot 06c835
dnl gives unlimited permission to copy and/or distribute it,
Packit Bot 06c835
dnl with or without modifications, as long as this notice is preserved.
Packit Bot 06c835
Packit Bot 06c835
AC_DEFUN([gl_FUNC_MBSINIT],
Packit Bot 06c835
[
Packit Bot 06c835
  AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
Packit Bot 06c835
  AC_REQUIRE([AC_CANONICAL_HOST])
Packit Bot 06c835
Packit Bot 06c835
  AC_REQUIRE([AC_TYPE_MBSTATE_T])
Packit Bot 06c835
  gl_MBSTATE_T_BROKEN
Packit Bot 06c835
Packit Bot 06c835
  AC_CHECK_FUNCS_ONCE([mbsinit])
Packit Bot 06c835
  if test $ac_cv_func_mbsinit = no; then
Packit Bot 06c835
    HAVE_MBSINIT=0
Packit Bot 06c835
    AC_CHECK_DECLS([mbsinit],,, [[
Packit Bot 06c835
/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
Packit Bot 06c835
   <wchar.h>.
Packit Bot 06c835
   BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
Packit Bot 06c835
   included before <wchar.h>.  */
Packit Bot 06c835
#include <stddef.h>
Packit Bot 06c835
#include <stdio.h>
Packit Bot 06c835
#include <time.h>
Packit Bot 06c835
#include <wchar.h>
Packit Bot 06c835
]])
Packit Bot 06c835
    if test $ac_cv_have_decl_mbsinit = yes; then
Packit Bot 06c835
      dnl On Minix 3.1.8, the system's <wchar.h> declares mbsinit() although
Packit Bot 06c835
      dnl it does not have the function. Avoid a collision with gnulib's
Packit Bot 06c835
      dnl replacement.
Packit Bot 06c835
      REPLACE_MBSINIT=1
Packit Bot 06c835
    fi
Packit Bot 06c835
  else
Packit Bot 06c835
    if test $REPLACE_MBSTATE_T = 1; then
Packit Bot 06c835
      REPLACE_MBSINIT=1
Packit Bot 06c835
    else
Packit Bot 06c835
      dnl On mingw, mbsinit() always returns 1, which is inappropriate for
Packit Bot 06c835
      dnl states produced by mbrtowc() for an incomplete multibyte character
Packit Bot 06c835
      dnl in multibyte locales.
Packit Bot 06c835
      case "$host_os" in
Packit Bot 06c835
        mingw*) REPLACE_MBSINIT=1 ;;
Packit Bot 06c835
      esac
Packit Bot 06c835
    fi
Packit Bot 06c835
  fi
Packit Bot 06c835
])
Packit Bot 06c835
Packit Bot 06c835
# Prerequisites of lib/mbsinit.c.
Packit Bot 06c835
AC_DEFUN([gl_PREREQ_MBSINIT], [
Packit Bot 06c835
  :
Packit Bot 06c835
])