From b18fc1ca50570b0674095ee87711e19ee95ae8df Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Thu, 22 Feb 2018 20:42:42 -0800 Subject: build: make drm optional --- configure.ac | 7 ++++++- src/Makefile.am | 5 ++++- src/rototiller.c | 7 ++++++- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index de7ee3e..578e420 100644 --- a/configure.ac +++ b/configure.ac @@ -7,7 +7,12 @@ AM_PROG_AR AC_PROG_RANLIB AM_SILENT_RULES([yes]) -PKG_CHECK_MODULES(DRM, libdrm) +PKG_CHECK_MODULES(DRM, libdrm, + AM_CONDITIONAL(ENABLE_DRM, true) + AC_DEFINE(HAVE_DRM, [1], [Define to 1 with drm present]), + AM_CONDITIONAL(ENABLE_DRM, false) +) + LIBS="$DRM_LIBS $LIBS" CFLAGS="$DRM_CFLAGS $CFLAGS" diff --git a/src/Makefile.am b/src/Makefile.am index 3d6b8bc..b94b0f3 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,4 +1,7 @@ SUBDIRS = modules bin_PROGRAMS = rototiller -rototiller_SOURCES = drm_fb.c fb.c fb.h fps.c fps.h rototiller.c rototiller.h sdl_fb.c settings.h settings.c setup.h setup.c threads.c threads.h util.c util.h +rototiller_SOURCES = fb.c fb.h fps.c fps.h rototiller.c rototiller.h sdl_fb.c settings.h settings.c setup.h setup.c threads.c threads.h util.c util.h +if ENABLE_DRM +rototiller_SOURCES += drm_fb.c +endif rototiller_LDADD = -lm modules/julia/libjulia.a modules/plasma/libplasma.a modules/ray/libray.a modules/roto/libroto.a modules/sparkler/libsparkler.a modules/stars/libstars.a diff --git a/src/rototiller.c b/src/rototiller.c index 0fbc794..e4c818b 100644 --- a/src/rototiller.c +++ b/src/rototiller.c @@ -150,7 +150,9 @@ static int setup_video(settings_t *settings, setting_desc_t **next_setting) if (!video) { setting_desc_t *desc; const char *values[] = { +#ifdef HAVE_DRM "drm", +#endif "sdl", NULL, }; @@ -170,11 +172,14 @@ static int setup_video(settings_t *settings, setting_desc_t **next_setting) } /* XXX: this is kind of hacky for now */ +#ifdef HAVE_DRM if (!strcmp(video, "drm")) { fb_ops = &drm_fb_ops; return drm_fb_ops.setup(settings, next_setting); - } else if (!strcmp(video, "sdl")) { + } else +#endif + if (!strcmp(video, "sdl")) { fb_ops = &sdl_fb_ops; return sdl_fb_ops.setup(settings, next_setting); -- cgit v1.2.1