aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/compilers.py
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2016-05-24 12:17:40 +0530
committerNirbheek Chauhan <nirbheek@centricular.com>2016-05-24 12:18:59 +0530
commit4578e116182c3bc972b770a9cbdf69749dc234f9 (patch)
tree563f41619b35c7153c436bb63c644113ef964805 /mesonbuild/compilers.py
parentc9f16a4ab1eba56f7cc3d5901e1fdbda95840a08 (diff)
downloadmeson-4578e116182c3bc972b770a9cbdf69749dc234f9.zip
meson-4578e116182c3bc972b770a9cbdf69749dc234f9.tar.gz
meson-4578e116182c3bc972b770a9cbdf69749dc234f9.tar.bz2
compilers: Always include limits.h to make the stub machinery work
limits.h is a requirement of the C language and is available with all compilers and platforms from the last two decades. If limits.h is not available, the compiler only supports an ancient dialect of C and lots of other things will break too.
Diffstat (limited to 'mesonbuild/compilers.py')
-rw-r--r--mesonbuild/compilers.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/mesonbuild/compilers.py b/mesonbuild/compilers.py
index 492b790..494b6c6 100644
--- a/mesonbuild/compilers.py
+++ b/mesonbuild/compilers.py
@@ -692,6 +692,7 @@ int main(int argc, char **argv) {
# Then, undef the symbol to get rid of it completely.
templ = '''
#define {1} meson_disable_define_of_{1}
+ #include <limits.h>
{0}
#undef {1}
'''
@@ -709,6 +710,8 @@ int main(int argc, char **argv) {
# glibc defines functions that are not available on Linux as stubs that
# fail with ENOSYS (such as e.g. lchmod). In this case we want to fail
# instead of detecting the stub as a valid symbol.
+ # We always include limits.h above to ensure that these are defined for
+ # stub functions.
stubs_fail = '''
#if defined __stub_{1} || defined __stub___{1}
fail fail fail this function is not going to work