Blame m4/mbswidth.m4

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