aboutsummaryrefslogtreecommitdiff
path: root/test cases
diff options
context:
space:
mode:
authorDaniel Mensinger <daniel@mensinger-ka.de>2020-08-26 17:46:35 +0200
committerNirbheek Chauhan <nirbheek.chauhan@gmail.com>2020-08-27 00:08:02 +0000
commitf660b3fe4c308e43798db3e6e1407400c6d81b27 (patch)
treec526dc7090852a5ec2e8f2d7b9941be1b6cc4fc6 /test cases
parent3a25efc056c00da3fe10240757e3ae538fd57435 (diff)
downloadmeson-f660b3fe4c308e43798db3e6e1407400c6d81b27.zip
meson-f660b3fe4c308e43798db3e6e1407400c6d81b27.tar.gz
meson-f660b3fe4c308e43798db3e6e1407400c6d81b27.tar.bz2
tests: fix lchmod check for glibc >= 2.32 (fixes #6784)
Diffstat (limited to 'test cases')
-rw-r--r--test cases/common/39 has function/meson.build20
1 files changed, 14 insertions, 6 deletions
diff --git a/test cases/common/39 has function/meson.build b/test cases/common/39 has function/meson.build
index 16f43c4..26f13d6 100644
--- a/test cases/common/39 has function/meson.build
+++ b/test cases/common/39 has function/meson.build
@@ -54,15 +54,23 @@ foreach cc : compilers
args : unit_test_args),
'couldn\'t detect "poll" when defined by a header')
lchmod_prefix = '#include <sys/stat.h>\n#include <unistd.h>'
+ has_lchmod = cc.has_function('lchmod', prefix : lchmod_prefix, args : unit_test_args)
+
if host_system == 'linux'
- assert (not cc.has_function('lchmod', prefix : lchmod_prefix,
- args : unit_test_args),
- '"lchmod" check should have failed')
+ glibc_major = cc.get_define('__GLIBC__', prefix: '#include <gnu/libc-version.h>', args: unit_test_args)
+ glibc_minor = cc.get_define('__GLIBC_MINOR__', prefix: '#include <gnu/libc-version.h>', args: unit_test_args)
+ glibc_vers = '@0@.@1@'.format(glibc_major, glibc_minor)
+ message('GLIBC vetsion:', glibc_vers)
+
+ # lchmod was implemented in glibc 2.32 (https://sourceware.org/pipermail/libc-announce/2020/000029.html)
+ if glibc_vers.version_compare('<2.32')
+ assert (not has_lchmod, '"lchmod" check should have failed')
+ else
+ assert (has_lchmod, '"lchmod" check should have succeeded')
+ endif
else
# macOS and *BSD have lchmod
- assert (cc.has_function('lchmod', prefix : lchmod_prefix,
- args : unit_test_args),
- '"lchmod" check should have succeeded')
+ assert (has_lchmod, '"lchmod" check should have succeeded')
endif
# Check that built-ins are found properly both with and without headers
assert(cc.has_function('alloca', args : unit_test_args),