[glib] Check stpcpy() and posix_memalign() to *not* to be built-in
- From: LRN <ruslanizhb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] Check stpcpy() and posix_memalign() to *not* to be built-in
- Date: Wed, 28 Mar 2018 11:48:09 +0000 (UTC)
commit dcc452b5f90f003d7b5569cd8f260f7cff0954ba
Author: Руслан Ижбулатов <lrn1986 gmail com>
Date: Wed Mar 21 09:52:10 2018 +0000
Check stpcpy() and posix_memalign() to *not* to be built-in
GCC has built-ins for these functions, which might give a compile-only
test an impression that the functions are actually present in the C runtime.
Use a linked test to be sure.
Specifically, both functions are missing on Windows.
https://bugzilla.gnome.org/show_bug.cgi?id=794555
meson.build | 20 ++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
---
diff --git a/meson.build b/meson.build
index 80bb5e15c..9f08db92b 100644
--- a/meson.build
+++ b/meson.build
@@ -298,7 +298,6 @@ endif
functions = [
'alloca',
'mmap',
- 'posix_memalign',
'memalign',
'valloc',
'fsync',
@@ -310,7 +309,6 @@ functions = [
'lstat',
'strsignal',
'vsnprintf',
- 'stpcpy',
'poll',
'vasprintf',
'setenv',
@@ -401,6 +399,24 @@ foreach f : functions
endif
endforeach
+# Check that stpcpy() is not a builtin
+if cc.links('''#include <string.h>
+ int main (int argc, char ** argv) {
+ char p[10];
+ return stpcpy (p, argv[0]) != NULL;
+ }''', name : 'stpcpy() is not a builtin')
+ glib_conf.set('HAVE_STPCPY', 1)
+endif
+
+# Check that posix_memalign() is not a builtin
+if cc.links('''#include <stdlib.h>
+ int main (int argc, char ** argv) {
+ void *p;
+ return posix_memalign (&p, 16, argc);
+ }''', name : 'posix_memalign() is not a builtin')
+ glib_conf.set('HAVE_POSIX_MEMALIGN', 1)
+endif
+
# Check whether strerror_r returns char *
if have_func_strerror_r
if cc.compiles('''#define _GNU_SOURCE
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]