1 # mbswidth.m4 serial 11 2 dnl Copyright (C) 2000-2002, 2004 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 wctype.h) 13 AC_CHECK_FUNCS_ONCE(isascii iswprint mbsinit) 14 AC_CHECK_FUNCS(iswcntrl wcwidth) 15 gl_FUNC_MBRTOWC 16 17 AC_CACHE_CHECK([whether wcwidth is declared], ac_cv_have_decl_wcwidth, 18 [AC_TRY_COMPILE([ 19 /* AIX 3.2.5 declares wcwidth in <string.h>. */ 20 #if HAVE_STRING_H 21 # include <string.h> 22 #endif 23 #if HAVE_WCHAR_H 24 # include <wchar.h> 25 #endif 26 ], [ 27 #ifndef wcwidth 28 char *p = (char *) wcwidth; 29 #endif 30 ], ac_cv_have_decl_wcwidth=yes, ac_cv_have_decl_wcwidth=no)]) 31 if test $ac_cv_have_decl_wcwidth = yes; then 32 ac_val=1 33 else 34 ac_val=0 35 fi 36 AC_DEFINE_UNQUOTED(HAVE_DECL_WCWIDTH, $ac_val, 37 [Define to 1 if you have the declaration of wcwidth(), and to 0 otherwise.]) 38 39 dnl UnixWare 7.1.1 <wchar.h> has a declaration of a function mbswidth() 40 dnl that clashes with ours. 41 AC_CACHE_CHECK([whether mbswidth is declared in <wchar.h>], 42 ac_cv_have_decl_mbswidth, 43 [AC_TRY_COMPILE([ 44 #if HAVE_WCHAR_H 45 # include <wchar.h> 46 #endif 47 ], [ 48 char *p = (char *) mbswidth; 49 ], ac_cv_have_decl_mbswidth=yes, ac_cv_have_decl_mbswidth=no)]) 50 if test $ac_cv_have_decl_mbswidth = yes; then 51 ac_val=1 52 else 53 ac_val=0 54 fi 55 AC_DEFINE_UNQUOTED(HAVE_DECL_MBSWIDTH_IN_WCHAR_H, $ac_val, 56 [Define to 1 if you have a declaration of mbswidth() in <wchar.h>, and to 0 otherwise.]) 57 58 AC_TYPE_MBSTATE_T 59 ]) 60