aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/compilers.py
diff options
context:
space:
mode:
Diffstat (limited to 'mesonbuild/compilers.py')
-rw-r--r--mesonbuild/compilers.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/mesonbuild/compilers.py b/mesonbuild/compilers.py
index 23e7bbe..43d3356 100644
--- a/mesonbuild/compilers.py
+++ b/mesonbuild/compilers.py
@@ -1057,7 +1057,16 @@ int main(int argc, char **argv) {
# posix_memalign in the headers to point to that builtin which results
# in an invalid detection.
if '#include' not in prefix:
- code = 'int main() {{ {0}; }}'
+ code = '''
+ int main() {{
+ #ifdef __has_builtin
+ #if !__has_builtin({0})
+ #error "built-in {0} not found"
+ #endif
+ #else
+ {0};
+ #endif
+ }}'''
return self.links(code.format('__builtin_' + funcname), env,
extra_args, dependencies)
else: