Use #ifdef instead of #if for features to make Meson easier.

We mostly use #ifdef throughout the tree, and this lets the generated
config.h files just be #define TOKEN instead of #define TOKEN 1.

Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
This commit is contained in:
Eric Anholt 2017-04-25 16:03:00 -07:00 committed by Adam Jackson
parent ace6bfd590
commit c7be7a688a
10 changed files with 29 additions and 29 deletions

View File

@ -38,7 +38,7 @@
#endif #endif
#include <epoxy/gl.h> #include <epoxy/gl.h>
#if GLAMOR_HAS_GBM #ifdef GLAMOR_HAS_GBM
#define MESA_EGL_NO_X11_HEADERS #define MESA_EGL_NO_X11_HEADERS
#include <epoxy/egl.h> #include <epoxy/egl.h>
#endif #endif
@ -342,7 +342,7 @@ typedef struct glamor_pixmap_private {
GLuint pbo; GLuint pbo;
RegionRec prepare_region; RegionRec prepare_region;
Bool prepared; Bool prepared;
#if GLAMOR_HAS_GBM #ifdef GLAMOR_HAS_GBM
EGLImageKHR image; EGLImageKHR image;
#endif #endif
/** block width of this large pixmap. */ /** block width of this large pixmap. */

View File

@ -35,7 +35,7 @@
#ifndef _XF86_H #ifndef _XF86_H
#define _XF86_H #define _XF86_H
#if HAVE_XORG_CONFIG_H #ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h> #include <xorg-config.h>
#elif HAVE_DIX_CONFIG_H #elif HAVE_DIX_CONFIG_H
#include <dix-config.h> #include <dix-config.h>

View File

@ -55,7 +55,7 @@
#ifdef XSERVER_PLATFORM_BUS #ifdef XSERVER_PLATFORM_BUS
#include "xf86platformBus.h" #include "xf86platformBus.h"
#endif #endif
#if XSERVER_LIBPCIACCESS #ifdef XSERVER_LIBPCIACCESS
#include <pciaccess.h> #include <pciaccess.h>
#endif #endif
@ -227,7 +227,7 @@ check_outputs(int fd, int *count)
*count = res->count_connectors; *count = res->count_connectors;
ret = res->count_connectors > 0; ret = res->count_connectors > 0;
#if defined DRM_CAP_PRIME && GLAMOR_HAS_GBM_LINEAR #if defined(DRM_CAP_PRIME) && defined(GLAMOR_HAS_GBM_LINEAR)
if (ret == FALSE) { if (ret == FALSE) {
uint64_t value = 0; uint64_t value = 0;
if (drmGetCap(fd, DRM_CAP_PRIME, &value) == 0 && if (drmGetCap(fd, DRM_CAP_PRIME, &value) == 0 &&
@ -244,7 +244,7 @@ probe_hw(const char *dev, struct xf86_platform_device *platform_dev)
{ {
int fd; int fd;
#if XF86_PDEV_SERVER_FD #ifdef XF86_PDEV_SERVER_FD
if (platform_dev && (platform_dev->flags & XF86_PDEV_SERVER_FD)) { if (platform_dev && (platform_dev->flags & XF86_PDEV_SERVER_FD)) {
fd = xf86_platform_device_odev_attributes(platform_dev)->fd; fd = xf86_platform_device_odev_attributes(platform_dev)->fd;
if (fd == -1) if (fd == -1)
@ -366,7 +366,7 @@ ms_setup_entity(ScrnInfoPtr scrn, int entity_num)
pPriv->ptr = xnfcalloc(sizeof(modesettingEntRec), 1); pPriv->ptr = xnfcalloc(sizeof(modesettingEntRec), 1);
} }
#if XSERVER_LIBPCIACCESS #ifdef XSERVER_LIBPCIACCESS
static Bool static Bool
ms_pci_probe(DriverPtr driver, ms_pci_probe(DriverPtr driver,
int entity_num, struct pci_device *dev, intptr_t match_data) int entity_num, struct pci_device *dev, intptr_t match_data)
@ -826,7 +826,7 @@ ms_get_drm_master_fd(ScrnInfoPtr pScrn)
return TRUE; return TRUE;
} }
#if XSERVER_PLATFORM_BUS #ifdef XSERVER_PLATFORM_BUS
if (pEnt->location.type == BUS_PLATFORM) { if (pEnt->location.type == BUS_PLATFORM) {
#ifdef XF86_PDEV_SERVER_FD #ifdef XF86_PDEV_SERVER_FD
if (pEnt->location.id.plat->flags & XF86_PDEV_SERVER_FD) if (pEnt->location.id.plat->flags & XF86_PDEV_SERVER_FD)
@ -844,7 +844,7 @@ ms_get_drm_master_fd(ScrnInfoPtr pScrn)
} }
else else
#endif #endif
#if XSERVER_LIBPCIACCESS #ifdef XSERVER_LIBPCIACCESS
if (pEnt->location.type == BUS_PCI) { if (pEnt->location.type == BUS_PCI) {
char *BusID = NULL; char *BusID = NULL;
struct pci_device *PciInfo; struct pci_device *PciInfo;
@ -1018,7 +1018,7 @@ PreInit(ScrnInfoPtr pScrn, int flags)
if (ms->drmmode.glamor) if (ms->drmmode.glamor)
pScrn->capabilities |= RR_Capability_SinkOffload; pScrn->capabilities |= RR_Capability_SinkOffload;
} }
#if GLAMOR_HAS_GBM_LINEAR #ifdef GLAMOR_HAS_GBM_LINEAR
if (value & DRM_PRIME_CAP_EXPORT && ms->drmmode.glamor) if (value & DRM_PRIME_CAP_EXPORT && ms->drmmode.glamor)
pScrn->capabilities |= RR_Capability_SourceOutput | RR_Capability_SourceOffload; pScrn->capabilities |= RR_Capability_SourceOutput | RR_Capability_SourceOffload;
#endif #endif
@ -1189,7 +1189,7 @@ msEnableSharedPixmapFlipping(RRCrtcPtr crtc, PixmapPtr front, PixmapPtr back)
if (ms->drmmode.reverse_prime_offload_mode) if (ms->drmmode.reverse_prime_offload_mode)
return FALSE; return FALSE;
#if XSERVER_PLATFORM_BUS #ifdef XSERVER_PLATFORM_BUS
if (pEnt->location.type == BUS_PLATFORM) { if (pEnt->location.type == BUS_PLATFORM) {
char *syspath = char *syspath =
xf86_platform_device_odev_attributes(pEnt->location.id.plat)-> xf86_platform_device_odev_attributes(pEnt->location.id.plat)->

View File

@ -627,10 +627,10 @@ static const char *compiled_in_modules[] = {
"extmod", "extmod",
"dri", "dri",
"dri2", "dri2",
#if DRI3 #ifdef DRI3
"dri3", "dri3",
#endif #endif
#if PRESENT #ifdef PRESENT
"present", "present",
#endif #endif
NULL NULL

View File

@ -58,7 +58,7 @@ cat > sdksyms.c << EOF
#include "shmint.h" #include "shmint.h"
#endif #endif
#include "syncsdk.h" #include "syncsdk.h"
#if XINERAMA #ifdef XINERAMA
# include "panoramiXsrv.h" # include "panoramiXsrv.h"
# include "panoramiX.h" # include "panoramiX.h"
#endif #endif
@ -97,7 +97,7 @@ cat > sdksyms.c << EOF
/* hw/xfree86/dri2/Makefile.am -- module */ /* hw/xfree86/dri2/Makefile.am -- module */
#if DRI2 #ifdef DRI2
# include "dri2.h" # include "dri2.h"
#endif #endif
@ -131,7 +131,7 @@ cat > sdksyms.c << EOF
#include "xf86str.h" #include "xf86str.h"
#include "xf86Xinput.h" #include "xf86Xinput.h"
#include "xisb.h" #include "xisb.h"
#if XV #ifdef XV
# include "xf86xv.h" # include "xf86xv.h"
# include "xf86xvmc.h" # include "xf86xvmc.h"
# include "xf86xvpriv.h" # include "xf86xvpriv.h"
@ -189,7 +189,7 @@ cat > sdksyms.c << EOF
/* hw/xfree86/dri/Makefile.am -- module */ /* hw/xfree86/dri/Makefile.am -- module */
#if XF86DRI #ifdef XF86DRI
# include "dri.h" # include "dri.h"
# include "sarea.h" # include "sarea.h"
# include "dristruct.h" # include "dristruct.h"

View File

@ -580,7 +580,7 @@ xwl_window_post_damage(struct xwl_window *xwl_window)
region = DamageRegion(xwl_window->damage); region = DamageRegion(xwl_window->damage);
pixmap = (*xwl_screen->screen->GetWindowPixmap) (xwl_window->window); pixmap = (*xwl_screen->screen->GetWindowPixmap) (xwl_window->window);
#if GLAMOR_HAS_GBM #ifdef GLAMOR_HAS_GBM
if (xwl_screen->glamor) if (xwl_screen->glamor)
buffer = xwl_glamor_pixmap_get_wl_buffer(pixmap); buffer = xwl_glamor_pixmap_get_wl_buffer(pixmap);
else else

View File

@ -132,7 +132,7 @@ extern long SmartScheduleTime;
extern long SmartScheduleInterval; extern long SmartScheduleInterval;
extern long SmartScheduleSlice; extern long SmartScheduleSlice;
extern long SmartScheduleMaxSlice; extern long SmartScheduleMaxSlice;
#if HAVE_SETITIMER #ifdef HAVE_SETITIMER
extern Bool SmartScheduleSignalEnable; extern Bool SmartScheduleSignalEnable;
#else #else
#define SmartScheduleSignalEnable FALSE #define SmartScheduleSignalEnable FALSE

View File

@ -466,7 +466,7 @@ AccessUsingXdmcp(void);
extern _X_EXPORT void extern _X_EXPORT void
DefineSelf(int /*fd */ ); DefineSelf(int /*fd */ );
#if XDMCP #ifdef XDMCP
extern _X_EXPORT void extern _X_EXPORT void
AugmentSelf(void *from, int len); AugmentSelf(void *from, int len);

View File

@ -27,7 +27,7 @@
#error must inclue dix-config.h to use xserver_poll.h #error must inclue dix-config.h to use xserver_poll.h
#endif #endif
#if HAVE_POLL #ifdef HAVE_POLL
#include <poll.h> #include <poll.h>
#define xserver_poll(fds, nfds, timeout) poll(fds, nfds, timeout) #define xserver_poll(fds, nfds, timeout) poll(fds, nfds, timeout)
#else #else

View File

@ -1008,7 +1008,7 @@ ProcessCommandLine(int argc, char *argv[])
#endif #endif
else if (strcmp(argv[i], "-dumbSched") == 0) { else if (strcmp(argv[i], "-dumbSched") == 0) {
InputThreadEnable = FALSE; InputThreadEnable = FALSE;
#if HAVE_SETITIMER #ifdef HAVE_SETITIMER
SmartScheduleSignalEnable = FALSE; SmartScheduleSignalEnable = FALSE;
#endif #endif
} }
@ -1210,7 +1210,7 @@ XNFstrdup(const char *s)
void void
SmartScheduleStopTimer(void) SmartScheduleStopTimer(void)
{ {
#if HAVE_SETITIMER #ifdef HAVE_SETITIMER
struct itimerval timer; struct itimerval timer;
if (!SmartScheduleSignalEnable) if (!SmartScheduleSignalEnable)
@ -1226,7 +1226,7 @@ SmartScheduleStopTimer(void)
void void
SmartScheduleStartTimer(void) SmartScheduleStartTimer(void)
{ {
#if HAVE_SETITIMER #ifdef HAVE_SETITIMER
struct itimerval timer; struct itimerval timer;
if (!SmartScheduleSignalEnable) if (!SmartScheduleSignalEnable)
@ -1239,7 +1239,7 @@ SmartScheduleStartTimer(void)
#endif #endif
} }
#if HAVE_SETITIMER #ifdef HAVE_SETITIMER
static void static void
SmartScheduleTimer(int sig) SmartScheduleTimer(int sig)
{ {
@ -1287,7 +1287,7 @@ SmartSchedulePause(void)
void void
SmartScheduleInit(void) SmartScheduleInit(void)
{ {
#if HAVE_SETITIMER #ifdef HAVE_SETITIMER
if (SmartScheduleEnable() < 0) { if (SmartScheduleEnable() < 0) {
perror("sigaction for smart scheduler"); perror("sigaction for smart scheduler");
SmartScheduleSignalEnable = FALSE; SmartScheduleSignalEnable = FALSE;
@ -1444,7 +1444,7 @@ Popen(const char *command, const char *type)
} }
/* Ignore the smart scheduler while this is going on */ /* Ignore the smart scheduler while this is going on */
#if HAVE_SETITIMER #ifdef HAVE_SETITIMER
if (SmartSchedulePause() < 0) { if (SmartSchedulePause() < 0) {
close(pdes[0]); close(pdes[0]);
close(pdes[1]); close(pdes[1]);
@ -1459,7 +1459,7 @@ Popen(const char *command, const char *type)
close(pdes[0]); close(pdes[0]);
close(pdes[1]); close(pdes[1]);
free(cur); free(cur);
#if HAVE_SETITIMER #ifdef HAVE_SETITIMER
if (SmartScheduleEnable() < 0) if (SmartScheduleEnable() < 0)
perror("signal"); perror("signal");
#endif #endif
@ -1636,7 +1636,7 @@ Pclose(void *iop)
/* allow EINTR again */ /* allow EINTR again */
OsReleaseSignals(); OsReleaseSignals();
#if HAVE_SETITIMER #ifdef HAVE_SETITIMER
if (SmartScheduleEnable() < 0) { if (SmartScheduleEnable() < 0) {
perror("signal"); perror("signal");
return -1; return -1;