mbswidth.m4 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. # mbswidth.m4 serial 18
  2. dnl Copyright (C) 2000-2002, 2004, 2006-2017 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. dnl autoconf tests required for use of mbswidth.c
  7. dnl From Bruno Haible.
  8. AC_DEFUN([gl_MBSWIDTH],
  9. [
  10. AC_CHECK_HEADERS_ONCE([wchar.h])
  11. AC_CHECK_FUNCS_ONCE([isascii mbsinit])
  12. dnl UnixWare 7.1.1 <wchar.h> has a declaration of a function mbswidth()
  13. dnl that clashes with ours.
  14. AC_CACHE_CHECK([whether mbswidth is declared in <wchar.h>],
  15. [ac_cv_have_decl_mbswidth],
  16. [AC_COMPILE_IFELSE(
  17. [AC_LANG_PROGRAM(
  18. [[
  19. /* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
  20. <wchar.h>.
  21. BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be included
  22. before <wchar.h>. */
  23. #include <stddef.h>
  24. #include <stdio.h>
  25. #include <time.h>
  26. #include <wchar.h>
  27. ]],
  28. [[
  29. char *p = (char *) mbswidth;
  30. return !p;
  31. ]])],
  32. [ac_cv_have_decl_mbswidth=yes],
  33. [ac_cv_have_decl_mbswidth=no])])
  34. if test $ac_cv_have_decl_mbswidth = yes; then
  35. ac_val=1
  36. else
  37. ac_val=0
  38. fi
  39. AC_DEFINE_UNQUOTED([HAVE_DECL_MBSWIDTH_IN_WCHAR_H], [$ac_val],
  40. [Define to 1 if you have a declaration of mbswidth() in <wchar.h>, and to 0 otherwise.])
  41. AC_TYPE_MBSTATE_T
  42. ])