Blame m4/mbswidth.m4

Packit Service a2489d
# mbswidth.m4 serial 18
Packit Service a2489d
dnl Copyright (C) 2000-2002, 2004, 2006-2018 Free Software Foundation, Inc.
Packit Service a2489d
dnl This file is free software; the Free Software Foundation
Packit Service a2489d
dnl gives unlimited permission to copy and/or distribute it,
Packit Service a2489d
dnl with or without modifications, as long as this notice is preserved.
Packit Service a2489d
Packit Service a2489d
dnl autoconf tests required for use of mbswidth.c
Packit Service a2489d
dnl From Bruno Haible.
Packit Service a2489d
Packit Service a2489d
AC_DEFUN([gl_MBSWIDTH],
Packit Service a2489d
[
Packit Service a2489d
  AC_CHECK_HEADERS_ONCE([wchar.h])
Packit Service a2489d
  AC_CHECK_FUNCS_ONCE([isascii mbsinit])
Packit Service a2489d
Packit Service a2489d
  dnl UnixWare 7.1.1 <wchar.h> has a declaration of a function mbswidth()
Packit Service a2489d
  dnl that clashes with ours.
Packit Service a2489d
  AC_CACHE_CHECK([whether mbswidth is declared in <wchar.h>],
Packit Service a2489d
    [ac_cv_have_decl_mbswidth],
Packit Service a2489d
    [AC_COMPILE_IFELSE(
Packit Service a2489d
       [AC_LANG_PROGRAM(
Packit Service a2489d
          [[
Packit Service a2489d
/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
Packit Service a2489d
   <wchar.h>.
Packit Service a2489d
   BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be included
Packit Service a2489d
   before <wchar.h>.  */
Packit Service a2489d
#include <stddef.h>
Packit Service a2489d
#include <stdio.h>
Packit Service a2489d
#include <time.h>
Packit Service a2489d
#include <wchar.h>
Packit Service a2489d
          ]],
Packit Service a2489d
          [[
Packit Service a2489d
  char *p = (char *) mbswidth;
Packit Service a2489d
  return !p;
Packit Service a2489d
          ]])],
Packit Service a2489d
       [ac_cv_have_decl_mbswidth=yes],
Packit Service a2489d
       [ac_cv_have_decl_mbswidth=no])])
Packit Service a2489d
  if test $ac_cv_have_decl_mbswidth = yes; then
Packit Service a2489d
    ac_val=1
Packit Service a2489d
  else
Packit Service a2489d
    ac_val=0
Packit Service a2489d
  fi
Packit Service a2489d
  AC_DEFINE_UNQUOTED([HAVE_DECL_MBSWIDTH_IN_WCHAR_H], [$ac_val],
Packit Service a2489d
    [Define to 1 if you have a declaration of mbswidth() in <wchar.h>, and to 0 otherwise.])
Packit Service a2489d
Packit Service a2489d
  AC_TYPE_MBSTATE_T
Packit Service a2489d
])