aboutsummaryrefslogtreecommitdiffstats
path: root/meson.build
diff options
context:
space:
mode:
authorJan Beich <[email protected]>2020-05-30 22:41:48 +0000
committerMarge Bot <[email protected]>2020-06-16 23:24:54 +0000
commit63b81c9915ce438e73e14412cbf3a9154b415f35 (patch)
treeb3cb47a502aeeda6e428294901ded34d6ce2a11d /meson.build
parent2a80f96b51134c74f2836493f97ee48239382799 (diff)
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 <[email protected]> Reviewed-by: Eric Engestrom <[email protected]> Cc: mesa-stable Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5462>
Diffstat (limited to 'meson.build')
-rw-r--r--meson.build9
1 files changed, 8 insertions, 1 deletions
diff --git a/meson.build b/meson.build
index 1932410fcf7..f14af82ace7 100644
--- a/meson.build
+++ b/meson.build
@@ -1202,7 +1202,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.check_header('sys/sysctl.h', prefix : '#include <sys/types.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.check_header(h)
pre_args += '-DHAVE_@0@'.format(h.to_upper().underscorify())
endif