summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Reiter <creiter@src.gnome.org>2018-04-25 10:48:51 +0200
committerChristoph Reiter <creiter@src.gnome.org>2018-04-25 17:23:49 +0200
commit06d61434c9ec22accfcb0fe2bb7e991d540f9df9 (patch)
tree2a398b71bde5be42074ca26bba9308d7b9c174a5
parentd137cebf8f1fc15cec9938fc649e99c382b2a23c (diff)
downloadglib-06d61434c9ec22accfcb0fe2bb7e991d540f9df9.tar.gz
meson: pass -fno-builtin when testing whether stpcpy is a builtin
In https://bugzilla.gnome.org/show_bug.cgi?id=794555 the tests for posix_memalign and stpcpy were extended to catch the case where the compiler provides an incomplete builtin. Under MSYS2 the example code still compiles and links while the real usage of stpcpy fails to build. To prevent the MSYS2 gcc from using the builtin versions pass -fno-builtin. https://bugzilla.gnome.org/show_bug.cgi?id=793729
-rw-r--r--meson.build16
1 files changed, 14 insertions, 2 deletions
diff --git a/meson.build b/meson.build
index cf8c69b25..8c48bf55a 100644
--- a/meson.build
+++ b/meson.build
@@ -453,12 +453,21 @@ foreach f : functions
endif
endforeach
+if cc.get_id() == 'gcc' or cc.get_id() == 'clang'
+ no_builtin_args = cc.get_supported_arguments(['-fno-builtin'])
+else
+ no_builtin_args = []
+endif
+
# 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')
+ }
+ ''',
+ args : no_builtin_args,
+ name : 'stpcpy() is not a builtin')
glib_conf.set('HAVE_STPCPY', 1)
endif
@@ -467,7 +476,10 @@ 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')
+ }
+ ''',
+ args : no_builtin_args,
+ name : 'posix_memalign() is not a builtin')
glib_conf.set('HAVE_POSIX_MEMALIGN', 1)
endif