meson: always define whether headers exist

Combined with -Wundef (added in 75758d2ccf & enforced in ba17673eed),
this provides absolute safety against #ifdef typos.

Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
main
Eric Engestrom 2018-11-07 15:00:24 +00:00 committed by Eric Engestrom
parent 077e64292c
commit 074947ee4b
10 changed files with 12 additions and 9 deletions

View File

@ -1,6 +1,9 @@
# XXX: Consider moving these to config.h analogous to autoconf.
LOCAL_CFLAGS += \
-DMAJOR_IN_SYSMACROS=1 \
-DHAVE_ALLOCA_H=0 \
-DHAVE_SYS_SELECT_H=0 \
-DHAVE_SYS_SYSCTL_H=0 \
-DHAVE_VISIBILITY=1 \
-fvisibility=hidden \
-DHAVE_LIBDRM_ATOMIC_PRIMITIVES=1

View File

@ -28,7 +28,7 @@
#include <pthread.h>
#include <sched.h>
#include <sys/ioctl.h>
#ifdef HAVE_ALLOCA_H
#if HAVE_ALLOCA_H
# include <alloca.h>
#endif

View File

@ -187,7 +187,7 @@ dep_m = cc.find_library('m', required : false)
# 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']
config.set('HAVE_' + header.underscorify().to_upper(),
config.set10('HAVE_' + header.underscorify().to_upper(),
cc.compiles('#include <sys/types.h>\n#include <@0@>'.format(header), name : '@0@ works'.format(header)))
endforeach
if (cc.has_header_symbol('sys/sysmacros.h', 'major') and

View File

@ -30,7 +30,7 @@
#endif
#include <sys/stat.h>
#include <fcntl.h>
#ifdef HAVE_ALLOCA_H
#if HAVE_ALLOCA_H
# include <alloca.h>
#endif
#include <sys/wait.h>

View File

@ -24,7 +24,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#ifdef HAVE_ALLOCA_H
#if HAVE_ALLOCA_H
# include <alloca.h>
#endif

View File

@ -28,7 +28,7 @@
#include <stdint.h>
#include <string.h>
#include <unistd.h>
#ifdef HAVE_SYS_SELECT_H
#if HAVE_SYS_SELECT_H
#include <sys/select.h>
#endif

View File

@ -28,7 +28,7 @@
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#ifdef HAVE_SYS_SELECT_H
#if HAVE_SYS_SELECT_H
#include <sys/select.h>
#endif

View File

@ -51,7 +51,7 @@
#include <errno.h>
#include <poll.h>
#include <sys/time.h>
#ifdef HAVE_SYS_SELECT_H
#if HAVE_SYS_SELECT_H
#include <sys/select.h>
#endif
#include <math.h>

View File

@ -33,7 +33,7 @@
#include <errno.h>
#include <poll.h>
#include <sys/time.h>
#ifdef HAVE_SYS_SELECT_H
#if HAVE_SYS_SELECT_H
#include <sys/select.h>
#endif

View File

@ -42,7 +42,7 @@
#include <stdint.h>
#include <stdlib.h>
#include <sys/ioctl.h>
#ifdef HAVE_SYS_SYSCTL_H
#if HAVE_SYS_SYSCTL_H
#include <sys/sysctl.h>
#endif
#include <stdio.h>