Blame m4/mbsinit.m4

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