summaryrefslogtreecommitdiff
path: root/lang/mono/patches/patch-mono_eglib_giconv.c
blob: f0c6e4e289f405806c5d6dd05b94b7d9a1b21a2f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
$NetBSD: patch-mono_eglib_giconv.c,v 1.1 2021/03/03 12:05:41 nia Exp $

Support POSIX iconv(3) on modern NetBSD.

--- mono/eglib/giconv.c.orig	2020-04-30 07:46:10.000000000 +0000
+++ mono/eglib/giconv.c
@@ -37,6 +37,14 @@
 #define FORCE_INLINE(RET_TYPE) inline RET_TYPE __attribute__((always_inline))
 #endif
 
+#if defined(__NetBSD__)
+#include <sys/param.h>
+#if __NetBSD_Prereq__(9,99,17)
+#define NETBSD_POSIX_ICONV 1
+#else
+#define NETBSD_POSIX_ICONV 0
+#endif
+#endif
 
 #define UNROLL_DECODE_UTF8 0
 #define UNROLL_ENCODE_UTF8 0
@@ -197,7 +205,7 @@ g_iconv (GIConv cd, gchar **inbytes, gsi
 			outleftptr = NULL;
 		}
 // AIX needs this for C++ and GNU iconv
-#if defined(__NetBSD__) || defined(_AIX)
+#if (defined(__NetBSD__) && !NETBSD_POSIX_ICONV) || defined(_AIX)
 		return iconv (cd->cd, (const gchar **)inbytes, inleftptr, outbytes, outleftptr);
 #else
 		return iconv (cd->cd, inbytes, inleftptr, outbytes, outleftptr);