changeset 38500:a9fe103a4629

wctype-h: Fix compilation error with the original mingw.org mingw. * m4/wctype_h.m4 (gl_WCTYPE_H): Test for <crtdefs.h>. Set HAVE_CRTDEFS_H. * modules/wctype-h (Makefile.am): Substitute HAVE_CRTDEFS_H. * lib/wctype.in.h (rpl_wint_t): If <crtdefs.h> does not exist, include <stddef.h> instead. Reported and proposed by Eli Zaretskii <eliz@gnu.org>.
author Bruno Haible <bruno@clisp.org>
date Thu, 27 Apr 2017 18:59:24 +0200
parents cff55224d4eb
children 14728daba68a
files ChangeLog lib/wctype.in.h m4/wctype_h.m4 modules/wctype-h
diffstat 4 files changed, 28 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Wed Apr 26 21:46:55 2017 -0700
+++ b/ChangeLog	Thu Apr 27 18:59:24 2017 +0200
@@ -1,3 +1,13 @@
+2017-04-27  Bruno Haible  <bruno@clisp.org>
+
+	wctype-h: Fix compilation error with the original mingw.org mingw.
+	* m4/wctype_h.m4 (gl_WCTYPE_H): Test for <crtdefs.h>. Set
+	HAVE_CRTDEFS_H.
+	* modules/wctype-h (Makefile.am): Substitute HAVE_CRTDEFS_H.
+	* lib/wctype.in.h (rpl_wint_t): If <crtdefs.h> does not exist, include
+	<stddef.h> instead.
+	Reported and proposed by Eli Zaretskii <eliz@gnu.org>.
+
 2017-04-26  Pádraig Brady  <P@draigBrady.com>
 
 	nap.h: Fix compilation on non windows platforms
--- a/lib/wctype.in.h	Wed Apr 26 21:46:55 2017 -0700
+++ b/lib/wctype.in.h	Thu Apr 27 18:59:24 2017 +0200
@@ -105,12 +105,16 @@
 #  define WEOF -1
 # endif
 #else
-/* mingw and MSVC define wint_t as 'unsigned short' in <crtdefs.h>.
-   This is too small: ISO C 99 section 7.24.1.(2) says that wint_t must be
-   "unchanged by default argument promotions".  Override it.  */
+/* mingw and MSVC define wint_t as 'unsigned short' in <crtdefs.h> or
+   <stddef.h>.  This is too small: ISO C 99 section 7.24.1.(2) says that
+   wint_t must be "unchanged by default argument promotions".  Override it.  */
 # if @GNULIB_OVERRIDES_WINT_T@
 #  if !GNULIB_defined_wint_t
-#   include <crtdefs.h>
+#   if @HAVE_CRTDEFS_H@
+#    include <crtdefs.h>
+#   else
+#    include <stddef.h>
+#   endif
 typedef unsigned int rpl_wint_t;
 #   undef wint_t
 #   define wint_t rpl_wint_t
--- a/m4/wctype_h.m4	Wed Apr 26 21:46:55 2017 -0700
+++ b/m4/wctype_h.m4	Thu Apr 27 18:59:24 2017 +0200
@@ -1,4 +1,4 @@
-# wctype_h.m4 serial 18
+# wctype_h.m4 serial 19
 
 dnl A placeholder for ISO C99 <wctype.h>, for platforms that lack it.
 
@@ -66,6 +66,14 @@
   fi
   AC_SUBST([HAVE_WCTYPE_H])
 
+  AC_CHECK_HEADERS_ONCE([crtdefs.h])
+  if test $ac_cv_header_crtdefs_h = yes; then
+    HAVE_CRTDEFS_H=1
+  else
+    HAVE_CRTDEFS_H=0
+  fi
+  AC_SUBST([HAVE_CRTDEFS_H])
+
   case "$gl_cv_func_iswcntrl_works" in
     *yes) REPLACE_ISWCNTRL=0 ;;
     *)    REPLACE_ISWCNTRL=1 ;;
--- a/modules/wctype-h	Wed Apr 26 21:46:55 2017 -0700
+++ b/modules/wctype-h	Thu Apr 27 18:59:24 2017 +0200
@@ -31,6 +31,7 @@
 	      -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
 	      -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
 	      -e 's|@''NEXT_WCTYPE_H''@|$(NEXT_WCTYPE_H)|g' \
+	      -e 's/@''HAVE_CRTDEFS_H''@/$(HAVE_CRTDEFS_H)/g' \
 	      -e 's/@''GNULIB_OVERRIDES_WINT_T''@/$(GNULIB_OVERRIDES_WINT_T)/g' \
 	      -e 's/@''GNULIB_ISWBLANK''@/$(GNULIB_ISWBLANK)/g' \
 	      -e 's/@''GNULIB_WCTYPE''@/$(GNULIB_WCTYPE)/g' \