Blame m4/mbsinit.m4

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