Home | History | Annotate | Line # | Download | only in m4
      1  1.1  christos # mbrtowc.m4 serial 8
      2  1.1  christos dnl Copyright (C) 2001-2002, 2004-2005 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 From Paul Eggert
      8  1.1  christos 
      9  1.1  christos dnl This file can be removed, and gl_FUNC_MBRTOWC replaced with
     10  1.1  christos dnl AC_FUNC_MBRTOWC, when autoconf 2.60 can be assumed everywhere.
     11  1.1  christos 
     12  1.1  christos AC_DEFUN([gl_FUNC_MBRTOWC],
     13  1.1  christos [
     14  1.1  christos   dnl Same as AC_FUNC_MBRTOWC in autoconf-2.60.
     15  1.1  christos   AC_CACHE_CHECK([whether mbrtowc and mbstate_t are properly declared],
     16  1.1  christos     gl_cv_func_mbrtowc,
     17  1.1  christos     [AC_LINK_IFELSE(
     18  1.1  christos        [AC_LANG_PROGRAM(
     19  1.1  christos             [[#include <wchar.h>]],
     20  1.1  christos             [[wchar_t wc;
     21  1.1  christos               char const s[] = "";
     22  1.1  christos               size_t n = 1;
     23  1.1  christos               mbstate_t state;
     24  1.1  christos               return ! (sizeof state && (mbrtowc) (&wc, s, n, &state));]])],
     25  1.1  christos        gl_cv_func_mbrtowc=yes,
     26  1.1  christos        gl_cv_func_mbrtowc=no)])
     27  1.1  christos   if test $gl_cv_func_mbrtowc = yes; then
     28  1.1  christos     AC_DEFINE([HAVE_MBRTOWC], 1,
     29  1.1  christos       [Define to 1 if mbrtowc and mbstate_t are properly declared.])
     30  1.1  christos   fi
     31  1.1  christos ])
     32