From 06d61434c9ec22accfcb0fe2bb7e991d540f9df9 Mon Sep 17 00:00:00 2001 From: Christoph Reiter Date: Wed, 25 Apr 2018 10:48:51 +0200 Subject: [PATCH] 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 --- meson.build | 16 ++++++++++++++-- 1 file 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 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 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