Import upstream version 1.27
[debian/tar] / m4 / mbrtowc.m4
index c353862973e4feda9a6d9036f39f76c6157fd804..4c9f38861c62cdc2383dc81ffeabd621a2761a3c 100644 (file)
@@ -1,5 +1,5 @@
-# mbrtowc.m4 serial 22
-dnl Copyright (C) 2001-2002, 2004-2005, 2008-2011 Free Software Foundation,
+# mbrtowc.m4 serial 25
+dnl Copyright (C) 2001-2002, 2004-2005, 2008-2013 Free Software Foundation,
 dnl Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -15,6 +15,22 @@ AC_DEFUN([gl_FUNC_MBRTOWC],
   AC_CHECK_FUNCS_ONCE([mbrtowc])
   if test $ac_cv_func_mbrtowc = no; then
     HAVE_MBRTOWC=0
+    AC_CHECK_DECLS([mbrtowc],,, [[
+/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
+   <wchar.h>.
+   BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
+   included before <wchar.h>.  */
+#include <stddef.h>
+#include <stdio.h>
+#include <time.h>
+#include <wchar.h>
+]])
+    if test $ac_cv_have_decl_mbrtowc = yes; then
+      dnl On Minix 3.1.8, the system's <wchar.h> declares mbrtowc() although
+      dnl it does not have the function. Avoid a collision with gnulib's
+      dnl replacement.
+      REPLACE_MBRTOWC=1
+    fi
   else
     if test $REPLACE_MBSTATE_T = 1; then
       REPLACE_MBRTOWC=1
@@ -53,11 +69,6 @@ AC_DEFUN([gl_FUNC_MBRTOWC],
       esac
     fi
   fi
-  if test $HAVE_MBRTOWC = 0 || test $REPLACE_MBRTOWC = 1; then
-    gl_REPLACE_WCHAR_H
-    AC_LIBOBJ([mbrtowc])
-    gl_PREREQ_MBRTOWC
-  fi
 ])
 
 dnl Test whether mbsinit() and mbrtowc() need to be overridden in a way that
@@ -88,9 +99,6 @@ AC_DEFUN([gl_MBSTATE_T_BROKEN],
   else
     REPLACE_MBSTATE_T=1
   fi
-  if test $REPLACE_MBSTATE_T = 1; then
-    gl_REPLACE_WCHAR_H
-  fi
 ])
 
 dnl Test whether mbrtowc puts the state into non-initial state when parsing an