[glib] meson: fix unit tests and "Invalid byte sequence in conversion input"
- From: Tim-Philipp Müller <tpm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] meson: fix unit tests and "Invalid byte sequence in conversion input"
- Date: Wed, 19 Jul 2017 10:14:00 +0000 (UTC)
commit 2ac8079b9414be67a99f736e15383e85da56f7dd
Author: Tim-Philipp Müller <tim centricular com>
Date: Wed Jul 19 10:34:45 2017 +0100
meson: fix unit tests and "Invalid byte sequence in conversion input"
Check if strerror_r returns a char * and define STRERROR_R_CHAR_P
if so, which is needed by g_strerror() since c8e268b
https://bugzilla.gnome.org/show_bug.cgi?id=784000
config.h.meson | 3 +++
meson.build | 17 +++++++++++++++++
2 files changed, 20 insertions(+), 0 deletions(-)
---
diff --git a/config.h.meson b/config.h.meson
index a3d090e..9be7901 100644
--- a/config.h.meson
+++ b/config.h.meson
@@ -398,6 +398,9 @@
/* Define to 1 if you have the `strerror_r' function. */
#mesondefine HAVE_STRERROR_R
+/* Define if strerror_r returns char * */
+#mesondefine STRERROR_R_CHAR_P
+
/* Define to 1 if you have the <strings.h> header file. */
#mesondefine HAVE_STRINGS_H
diff --git a/meson.build b/meson.build
index 8c82fb8..99afed0 100644
--- a/meson.build
+++ b/meson.build
@@ -339,6 +339,23 @@ foreach f : functions
endif
endforeach
+# Check whether strerror_r returns char *
+if have_func_strerror_r
+ if cc.compiles('''#define _GNU_SOURCE
+ #include <string.h>
+ int func (void) {
+ char error_string[256];
+ char *ptr = strerror_r (-2, error_string, 256);
+ char c = *strerror_r (-2, error_string, 256);
+ return c != 0 && ptr != (void*) 0L;
+ }
+ ''',
+ name : 'strerror_r() returns char *')
+ glib_conf.set('STRERROR_R_CHAR_P', 1,
+ description: 'Defined if strerror_r returns char *')
+ endif
+endif
+
# Special-case these functions that have alternative names on Windows/MSVC
if cc.has_function('snprintf') or cc.has_header_symbol('stdio.h', 'snprintf')
glib_conf.set('HAVE_SNPRINTF', 1)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]