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