From 0a190620a7ffc071d839ebe68cd8ed041edd1f33 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= <sebastien@dynare.org>
Date: Tue, 15 May 2018 19:29:17 +0200
Subject: [PATCH] Kludge for bug in MinGW, that defines __STDC_UTF_16__ but not
 char16_t

This breaks the matrix.h of older MATLABs (e.g. R2009a). Also see <uchar.h>.

(cherry picked from commit f665379fcc2756dc6df91394baad6d505447a1cd)
---
 mex/build/matlab/configure.ac | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/mex/build/matlab/configure.ac b/mex/build/matlab/configure.ac
index 258b5d40f..a06ffcc38 100644
--- a/mex/build/matlab/configure.ac
+++ b/mex/build/matlab/configure.ac
@@ -69,6 +69,10 @@ case ${host_os} in
   *mingw32*)
     # Ensure that -lpthread is statically linked under MinGW
     PTHREAD_LIBS="-Wl,-Bstatic -lpthread -Wl,-Bdynamic"
+    # Kludge for bug in MinGW, that defines __STDC_UTF_16__ but not char16_t
+    # This breaks the matrix.h of older MATLABs (e.g. R2009a)
+    # Also see <uchar.h>
+    CFLAGS="$CFLAGS -include stdint.h -Dchar16_t=uint_least16_t"
     ;;
 esac
 AX_PTHREAD
-- 
GitLab