Hello Bruno,

On Mon, Jul 04, 2005 at 01:18:25PM +0200, Bruno Haible wrote:
> On mingw32, mbrtowc.m4 "detects" that mbrtowc() exists, leading to
> link errors. Actually, mbrtowc() does not exist on this system,
> it's only declared in <wchar.h> but not actually implemented under
> this name.

why cannot we use the Autoconf macro AC_FUNC_MBRTOWC?

(I mean with current Autoconf.  If there is a need to support some
older versions of Autoconf, we could perhaps copy the definition of
the macro to gnulib's mbrtowc.m4.)

A copy of the macro is attached below; does it work for you?

Have a nice day,
        Stepan

# AC_FUNC_MBRTOWC
# ---------------
AN_FUNCTION([mbrtowc], [AC_FUNC_MBRTOWC])
AC_DEFUN([AC_FUNC_MBRTOWC],
[
  AC_CACHE_CHECK([whether mbrtowc and mbstate_t are properly declared],
    ac_cv_func_mbrtowc,
    [AC_LINK_IFELSE(
       [AC_LANG_PROGRAM(
            [EMAIL PROTECTED]:@include <wchar.h>]],
            [[wchar_t wc;
              char const s[] = "";
              size_t n = 1;
              mbstate_t state;
              return ! (sizeof state && (mbrtowc) (&wc, s, n, &state));]])],
       ac_cv_func_mbrtowc=yes,
       ac_cv_func_mbrtowc=no)])
  if test $ac_cv_func_mbrtowc = yes; then
    AC_DEFINE([HAVE_MBRTOWC], 1,
      [Define to 1 if mbrtowc and mbstate_t are properly declared.])
  fi
])



_______________________________________________
bug-gnulib mailing list
bug-gnulib@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-gnulib

Reply via email to