Mesa (staging/20.1): meson: unbreak sysctl.h detection on BSDs

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Jun 17 00:03:43 UTC 2020


Module: Mesa
Branch: staging/20.1
Commit: b23172b11943eb1226e62b7e7803aae2667ce058
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=b23172b11943eb1226e62b7e7803aae2667ce058

Author: Jan Beich <jbeich at FreeBSD.org>
Date:   Sat May 30 22:41:48 2020 +0000

meson: unbreak sysctl.h detection on BSDs

Code:
 #include <sys/sysctl.h>
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

<https://gitlab.freedesktop.org/mesa/drm/-/commit/1f8ada802391>
<https://gitlab.freedesktop.org/mesa/drm/-/commit/4083e8f2c659>

Reviewed-by: Niclas Zeising <zeising at daemonic.se>
Reviewed-by: Eric Engestrom <eric at engestrom.ch>
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5462>
(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 48374a85a25..4176833321d 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -4,7 +4,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 <sys/types.h> on FreeBSD and OpenBSD
+  if cc.compiles('#include <sys/types.h>\n#include <sys/sysctl.h>', 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_ at 0@'.format(h.to_upper().underscorify())
   endif



More information about the mesa-commit mailing list