| 1 |
# mbswidth.m4 serial 19 |
| 2 |
dnl Copyright (C) 2000-2002, 2004, 2006-2022 Free Software Foundation, Inc. |
| 3 |
dnl This file is free software; the Free Software Foundation |
| 4 |
dnl gives unlimited permission to copy and/or distribute it, |
| 5 |
dnl with or without modifications, as long as this notice is preserved. |
| 6 |
|
| 7 |
dnl autoconf tests required for use of mbswidth.c |
| 8 |
dnl From Bruno Haible. |
| 9 |
|
| 10 |
AC_DEFUN([gl_MBSWIDTH], |
| 11 |
[ |
| 12 |
AC_CHECK_HEADERS_ONCE([wchar.h]) |
| 13 |
AC_CHECK_FUNCS_ONCE([isascii mbsinit]) |
| 14 |
|
| 15 |
dnl UnixWare 7.1.1 <wchar.h> has a declaration of a function mbswidth() |
| 16 |
dnl that clashes with ours. |
| 17 |
AC_CACHE_CHECK([whether mbswidth is declared in <wchar.h>], |
| 18 |
[ac_cv_have_decl_mbswidth], |
| 19 |
[AC_COMPILE_IFELSE( |
| 20 |
[AC_LANG_PROGRAM( |
| 21 |
[[#include <wchar.h> |
| 22 |
]], |
| 23 |
[[char *p = (char *) mbswidth; |
| 24 |
return !p; |
| 25 |
]])], |
| 26 |
[ac_cv_have_decl_mbswidth=yes], |
| 27 |
[ac_cv_have_decl_mbswidth=no])]) |
| 28 |
if test $ac_cv_have_decl_mbswidth = yes; then |
| 29 |
ac_val=1 |
| 30 |
else |
| 31 |
ac_val=0 |
| 32 |
fi |
| 33 |
AC_DEFINE_UNQUOTED([HAVE_DECL_MBSWIDTH_IN_WCHAR_H], [$ac_val], |
| 34 |
[Define to 1 if you have a declaration of mbswidth() in <wchar.h>, and to 0 otherwise.]) |
| 35 |
|
| 36 |
AC_TYPE_MBSTATE_T |
| 37 |
]) |