Blame m4/mbsinit.m4

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