Home | History | Annotate | Line # | Download | only in m4
      1 # serial 9
      2 
      3 # From Paul Eggert.
      4 
      5 # BeOS 5 has <wchar.h> but does not define mbstate_t,
      6 # so you can't declare an object of that type.
      7 # Check for this incompatibility with Standard C.
      8 
      9 # Include stdlib.h first, because otherwise this test would fail on Linux
     10 # (at least glibc-2.1.3) because the "_XOPEN_SOURCE 500" definition elicits
     11 # a syntax error in wchar.h due to the use of undefined __int32_t.
     12 
     13 AC_DEFUN([AC_MBSTATE_T],
     14   [
     15    AC_CHECK_HEADERS(stdlib.h)
     16 
     17    AC_CACHE_CHECK([for mbstate_t], ac_cv_type_mbstate_t,
     18     [AC_TRY_COMPILE([
     19 #if HAVE_STDLIB_H
     20 # include <stdlib.h>
     21 #endif
     22 #include <wchar.h>],
     23       [mbstate_t x; return sizeof x;],
     24       ac_cv_type_mbstate_t=yes,
     25       ac_cv_type_mbstate_t=no)])
     26    if test $ac_cv_type_mbstate_t = no; then
     27      AC_DEFINE(mbstate_t, int,
     28 	       [Define to a type if <wchar.h> does not define.])
     29    fi])
     30