From b8539e6c8044bc39e7b33c3939a77a971757c61e Mon Sep 17 00:00:00 2001 From: Jan Beich Date: Sat, 30 May 2020 22:41:48 +0000 Subject: [PATCH] meson: unbreak sysctl.h detection on BSDs Code: #include Compiler stdout: Compiler stderr: In file included from testfile.c:1: /usr/include/sys/sysctl.h:1184:40: error: unknown type name 'size_t' int sysctl(const int *, u_int, void *, size_t *, const void *, size_t); ^ /usr/include/sys/sysctl.h:1185:40: error: unknown type name 'size_t' int sysctlbyname(const char *, void *, size_t *, const void *, size_t); ^ /usr/include/sys/sysctl.h:1186:42: error: unknown type name 'size_t' int sysctlnametomib(const char *, int *, size_t *); ^ 3 errors generated. Checking if "sys/sysctl.h" compiles: NO Reviewed-by: Niclas Zeising Reviewed-by: Eric Engestrom Cc: mesa-stable Part-of: (cherry picked from commit 63b81c9915ce438e73e14412cbf3a9154b415f35) --- .pick_status.json | 2 +- meson.build | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 74f2b879fd7..a5f1845b2bd 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -3028,7 +3028,7 @@ "description": "meson: unbreak sysctl.h detection on BSDs", "nominated": true, "nomination_type": 0, - "resolution": 0, + "resolution": 1, "master_sha": null, "because_sha": null }, diff --git a/meson.build b/meson.build index 703e7fc75ac..92f1da12886 100644 --- a/meson.build +++ b/meson.build @@ -1162,7 +1162,14 @@ if (cc.has_header_symbol('sys/mkdev.h', 'major') and pre_args += '-DMAJOR_IN_MKDEV' endif -foreach h : ['xlocale.h', 'sys/sysctl.h', 'linux/futex.h', 'endian.h', 'dlfcn.h', 'execinfo.h', 'sys/shm.h', 'cet.h'] +if not ['linux'].contains(host_machine.system()) + # Deprecated on Linux and requires on FreeBSD and OpenBSD + if cc.compiles('#include \n#include ', name : 'sys/sysctl.h') + pre_args += '-DHAVE_SYS_SYSCTL_H' + endif +endif + +foreach h : ['xlocale.h', 'linux/futex.h', 'endian.h', 'dlfcn.h', 'execinfo.h', 'sys/shm.h', 'cet.h'] if cc.compiles('#include <@0@>'.format(h), name : '@0@'.format(h)) pre_args += '-DHAVE_@0@'.format(h.to_upper().underscorify()) endif