6
6
#include <string.h>
7
7
#include <unistd.h>
8
8
#include <wayland-server-core.h>
9
- #include <wlr/backend/drm.h>
9
+
10
10
#include <wlr/backend/headless.h>
11
11
#include <wlr/backend/interface.h>
12
- #include <wlr/backend/libinput.h>
13
12
#include <wlr/backend/multi.h>
14
13
#include <wlr/backend/noop.h>
15
14
#include <wlr/backend/session.h>
22
21
#include "render/allocator.h"
23
22
#include "util/signal.h"
24
23
24
+ #if WLR_HAS_DRM_BACKEND
25
+ #include <wlr/backend/drm.h>
26
+ #endif
27
+
28
+ #if WLR_HAS_LIBINPUT_BACKEND
29
+ #include <wlr/backend/libinput.h>
30
+ #endif
31
+
25
32
#if WLR_HAS_X11_BACKEND
26
33
#include <wlr/backend/x11.h>
27
34
#endif
@@ -211,6 +218,7 @@ static struct wlr_backend *attempt_noop_backend(struct wl_display *display) {
211
218
return backend ;
212
219
}
213
220
221
+ #if WLR_HAS_DRM_BACKEND
214
222
static struct wlr_backend * attempt_drm_backend (struct wl_display * display ,
215
223
struct wlr_backend * backend , struct wlr_session * session ) {
216
224
struct wlr_device * gpus [8 ];
@@ -240,6 +248,7 @@ static struct wlr_backend *attempt_drm_backend(struct wl_display *display,
240
248
241
249
return primary_drm ;
242
250
}
251
+ #endif
243
252
244
253
static struct wlr_backend * attempt_backend_by_name (struct wl_display * display ,
245
254
struct wlr_backend * backend , struct wlr_session * * session ,
@@ -265,9 +274,17 @@ static struct wlr_backend *attempt_backend_by_name(struct wl_display *display,
265
274
}
266
275
267
276
if (strcmp (name , "libinput" ) == 0 ) {
277
+ #if WLR_HAS_LIBINPUT_BACKEND
268
278
return wlr_libinput_backend_create (display , * session );
279
+ #else
280
+ return NULL ;
281
+ #endif
269
282
} else {
283
+ #if WLR_HAS_DRM_BACKEND
270
284
return attempt_drm_backend (display , backend , * session );
285
+ #else
286
+ return NULL ;
287
+ #endif
271
288
}
272
289
}
273
290
@@ -355,6 +372,7 @@ struct wlr_backend *wlr_backend_autocreate(struct wl_display *display) {
355
372
return NULL ;
356
373
}
357
374
375
+ #if WLR_HAS_LIBINPUT_BACKEND
358
376
struct wlr_backend * libinput = wlr_libinput_backend_create (display ,
359
377
multi -> session );
360
378
if (!libinput ) {
@@ -364,7 +382,9 @@ struct wlr_backend *wlr_backend_autocreate(struct wl_display *display) {
364
382
return NULL ;
365
383
}
366
384
wlr_multi_backend_add (backend , libinput );
385
+ #endif
367
386
387
+ #if WLR_HAS_DRM_BACKEND
368
388
struct wlr_backend * primary_drm =
369
389
attempt_drm_backend (display , backend , multi -> session );
370
390
if (!primary_drm ) {
@@ -376,6 +396,7 @@ struct wlr_backend *wlr_backend_autocreate(struct wl_display *display) {
376
396
}
377
397
378
398
return backend ;
399
+ #endif
379
400
380
401
error :
381
402
wlr_backend_destroy (backend );
0 commit comments