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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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