diff options
author | Andrea Pappacoda <andrea@pappacoda.it> | 2024-09-28 12:00:43 +0200 |
---|---|---|
committer | Dylan Baker <dylan@pnwbakers.com> | 2024-09-30 10:19:43 -0700 |
commit | a31f8d68cb068ad84fab08c901b7f8c707dc420f (patch) | |
tree | 3e5d57dc050d3e9a020f450a72c7f7ded5e94a04 | |
parent | fb4995a2c607b8289ae97a3faa5917f2887da294 (diff) | |
download | meson-a31f8d68cb068ad84fab08c901b7f8c707dc420f.zip meson-a31f8d68cb068ad84fab08c901b7f8c707dc420f.tar.gz meson-a31f8d68cb068ad84fab08c901b7f8c707dc420f.tar.bz2 |
tests: use statx instead of sendmmsg in has_function test
Both recvmmsg/sendmmsg and statx require the `_GNU_SOURCE` symbol to be
defined to be shown in headers, but statx has the additional property of
being defined on all glibc systems[1], unlike recvmmsg which isn't
implemented on Hurd[2][3].
With this fix, all tests now pass on Hurd.
$ cat meson.build
project('test', 'c')
cc = meson.get_compiler('c')
cc.has_header_symbol('sys/stat.h', 'statx')
cc.has_header_symbol('sys/stat.h', 'statx', prefix: '#define _GNU_SOURCE')
cc.has_function('statx')
$ meson setup build
The Meson build system
Version: 1.5.1
Source dir: /tmp/tmp.XcWk4fMra4
Build dir: /tmp/tmp.XcWk4fMra4/build
Build type: native build
Project name: test
Project version: undefined
C compiler for the host machine: cc (gcc 14.2.0 "cc (Debian 14.2.0-3) 14.2.0")
C linker for the host machine: cc ld.bfd 2.43.1
Host machine cpu family: x86_64
Host machine cpu: x86_64
Header "sys/stat.h" has symbol "statx" : NO
Header "sys/stat.h" has symbol "statx" : YES
Checking for function "statx" : YES
Build targets in project: 0
[1]: https://sourceware.org/git/?p=glibc.git;a=blob;f=io/statx_generic.c;h=93faf12297cfcd37ba005a02e991eab351d74174;hb=HEAD
[2]: https://www.gnu.org/software/hurd/open_issues/glibc.html#recvmmsg
[3]: https://github.com/mesonbuild/meson/pull/4351
-rw-r--r-- | test cases/common/36 has function/meson.build | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/test cases/common/36 has function/meson.build b/test cases/common/36 has function/meson.build index bb3e869..d8b5398 100644 --- a/test cases/common/36 has function/meson.build +++ b/test cases/common/36 has function/meson.build @@ -98,12 +98,11 @@ foreach cc : compilers # For some functions one needs to define _GNU_SOURCE before including the # right headers to get them picked up. Make sure we can detect these functions # as well without any prefix - if cc.has_header_symbol('sys/socket.h', 'recvmmsg', + if cc.has_header_symbol('sys/stat.h', 'statx', prefix : '#define _GNU_SOURCE', args : unit_test_args) - # We assume that if recvmmsg exists sendmmsg does too - assert (cc.has_function('sendmmsg', args : unit_test_args), - 'Failed to detect function "sendmmsg" (should always exist).') + assert (cc.has_function('statx', args : unit_test_args), + 'Failed to detect function "statx" (should always exist).') endif # We should be able to find GCC and Clang __builtin functions |