2 dnl Copyright (C) 2020 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.
7 AC_DEFUN([gl_FUNC_C32RTOMB],
9 AC_REQUIRE([gl_UCHAR_H_DEFAULTS])
11 AC_REQUIRE([gl_MBRTOC32_SANITYCHECK])
13 dnl We can't use AC_CHECK_FUNC here, because c32rtomb() is defined as a
14 dnl static inline function on Haiku 2020.
15 AC_CACHE_CHECK([for c32rtomb], [gl_cv_func_c32rtomb],
22 return c32rtomb (buf, 0, NULL) == 0;
25 [gl_cv_func_c32rtomb=yes],
26 [gl_cv_func_c32rtomb=no])
28 if test $gl_cv_func_c32rtomb = no; then
31 dnl When we override mbrtoc32, redefining the meaning of the char32_t
32 dnl values, we need to override c32rtomb as well, for consistency.
33 if test $HAVE_WORKING_MBRTOC32 = 0; then
36 AC_CACHE_CHECK([whether c32rtomb return value is correct],
37 [gl_cv_func_c32rtomb_retval],
39 dnl Initial guess, used when cross-compiling.
43 aix*) gl_cv_func_c32rtomb_retval="guessing no" ;;
44 # Guess yes otherwise.
45 *) gl_cv_func_c32rtomb_retval="guessing yes" ;;
54 if (c32rtomb (NULL, 0, NULL) != 1)
58 [gl_cv_func_c32rtomb_retval=yes],
59 [gl_cv_func_c32rtomb_retval=no],
62 case "$gl_cv_func_c32rtomb_retval" in
64 *) AC_DEFINE([C32RTOMB_RETVAL_BUG], [1],
65 [Define if the c32rtomb function has an incorrect return value.])