From 1f8ada802391fa658eceeaffe7e151303f7ab3f7 Mon Sep 17 00:00:00 2001 From: Eric Engestrom Date: Sun, 29 Mar 2020 22:45:52 +0200 Subject: [PATCH] meson: don't detect on Linux The header is not required on Linux, and is in fact deprecated in glibc 2.30+ Reported-by: Seung-Woo Kim Cc: Niclas Zeising Signed-off-by: Eric Engestrom Tested-by: Niclas Zeising --- meson.build | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/meson.build b/meson.build index 0515866f..461fefe5 100644 --- a/meson.build +++ b/meson.build @@ -183,13 +183,23 @@ else dep_rt = [] endif dep_m = cc.find_library('m', required : false) -# From Niclas Zeising: -# FreeBSD requires sys/types.h for sys/sysctl.h, add it as part of the -# includes when checking for headers. -foreach header : ['sys/sysctl.h', 'sys/select.h', 'alloca.h'] + +# The header is not required on Linux, and is in fact deprecated in glibc 2.30+ +if ['linux'].contains(host_machine.system()) + config.set10('HAVE_SYS_SYSCTL_H', false) +else + # From Niclas Zeising: + # FreeBSD requires sys/types.h for sys/sysctl.h, so add it as part of + # the includes when checking for headers. + config.set10('HAVE_SYS_SYSCTL_H', + cc.compiles('#include \n#include ', name : 'sys/sysctl.h works')) +endif + +foreach header : ['sys/select.h', 'alloca.h'] config.set10('HAVE_' + header.underscorify().to_upper(), - cc.compiles('#include \n#include <@0@>'.format(header), name : '@0@ works'.format(header))) + cc.compiles('#include <@0@>'.format(header), name : '@0@ works'.format(header))) endforeach + if (cc.has_header_symbol('sys/sysmacros.h', 'major') and cc.has_header_symbol('sys/sysmacros.h', 'minor') and cc.has_header_symbol('sys/sysmacros.h', 'makedev'))