From 69077169545427acb2e8a3f1a487e6c144ed6f20 Mon Sep 17 00:00:00 2001 From: Vito Caputo Date: Tue, 29 Mar 2022 01:52:01 -0700 Subject: build: make sdl2 and rototiller bin optional Now that there's a decoupled libtil usable by alternative frontends by vendoring rototiller, the build should support fb-less rototiller-less configurations. In lieu of this change glimmer's build requires sdl2 despite not actually utilizing sdl_fb. Now that shouldn't be necessary, should there be neither libdrm or sdl2 present we'll only produce libtil and no rototiller binary at all. --- configure.ac | 26 ++++++++++++-------------- src/Makefile.am | 7 ++++++- src/main.c | 10 +++++++++- 3 files changed, 27 insertions(+), 16 deletions(-) diff --git a/configure.ac b/configure.ac index 3abca76..974b33d 100644 --- a/configure.ac +++ b/configure.ac @@ -8,29 +8,27 @@ AM_SILENT_RULES([yes]) LT_INIT([disable-shared]) PKG_CHECK_MODULES(DRM, libdrm, - AM_CONDITIONAL(ENABLE_DRM, true) + AM_CONDITIONAL(ENABLE_DRM, declare build_rototiller=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" +PKG_CHECK_MODULES(SDL, sdl2, + AM_CONDITIONAL(ENABLE_SDL, declare build_rototiller=true) + AC_DEFINE(HAVE_SDL, [1], [Define to 1 with sdl2 present]), + AM_CONDITIONAL(ENABLE_SDL, false) +) + +AM_CONDITIONAL(ENABLE_ROTOTILLER, [test "x$build_rototiller" = xtrue]) + +LIBS="$DRM_LIBS $SDL_LIBS $LIBS" +CFLAGS="$DRM_CFLAGS $SDL_CFLAGS $CFLAGS" AX_PTHREAD LIBS="$PTHREAD_LIBS $LIBS" -CFLAGS="$CFLAGS $PTHREAD_CFLAGS" +CFLAGS="$PTHREAD_CFLAGS $CFLAGS" CC="$PTHREAD_CC" -dnl Check for SDL -SDL_VERSION=2.0 -AM_PATH_SDL2($SDL_VERSION, - :, - AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!]) -) - -CFLAGS="$CFLAGS $SDL_CFLAGS" -LIBS="$LIBS $SDL_LIBS" - AC_CONFIG_FILES([ Makefile src/Makefile diff --git a/src/Makefile.am b/src/Makefile.am index 6ca1d77..aa42c08 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -5,9 +5,14 @@ libtil_la_SOURCES = til_args.c til_args.h til_fb.c til_fb.h til_knobs.h til.c ti libtil_la_CPPFLAGS = -I@top_srcdir@/src libtil_la_LIBADD = modules/compose/libcompose.la modules/drizzle/libdrizzle.la modules/flui2d/libflui2d.la modules/julia/libjulia.la modules/meta2d/libmeta2d.la modules/montage/libmontage.la modules/pixbounce/libpixbounce.la modules/plasma/libplasma.la modules/plato/libplato.la modules/ray/libray.la modules/roto/libroto.la modules/rtv/librtv.la modules/snow/libsnow.la modules/sparkler/libsparkler.la modules/spiro/libspiro.la modules/stars/libstars.la modules/submit/libsubmit.la modules/swab/libswab.la modules/swarm/libswarm.la libs/grid/libgrid.la libs/puddle/libpuddle.la libs/ray/libray.la libs/sig/libsig.la libs/txt/libtxt.la libs/ascii/libascii.la libs/din/libdin.la +if ENABLE_ROTOTILLER bin_PROGRAMS = rototiller -rototiller_SOURCES = fps.c fps.h main.c sdl_fb.c setup.h setup.c til.h til_fb.c til_fb.h til_knobs.h til_settings.c til_settings.h til_threads.c til_threads.h til_util.c til_util.h +rototiller_SOURCES = fps.c fps.h main.c setup.h setup.c til.h til_fb.c til_fb.h til_knobs.h til_settings.c til_settings.h til_threads.c til_threads.h til_util.c til_util.h +if ENABLE_SDL +rototiller_SOURCES += sdl_fb.c +endif if ENABLE_DRM rototiller_SOURCES += drm_fb.c endif rototiller_LDADD = libtil.la -lm +endif diff --git a/src/main.c b/src/main.c index c6b0362..c19b6b5 100644 --- a/src/main.c +++ b/src/main.c @@ -27,7 +27,11 @@ * another page so we can begin rendering another frame before vsync. With * just two pages we end up twiddling thumbs until the vsync arrives. */ +#ifdef HAVE_SDL #define DEFAULT_VIDEO "sdl" +#else +#define DEFAULT_VIDEO "drm" +#endif extern til_fb_ops_t drm_fb_ops; extern til_fb_ops_t sdl_fb_ops; @@ -68,7 +72,9 @@ static int setup_video(til_settings_t *settings, til_setting_t **res_setting, co #ifdef HAVE_DRM "drm", #endif +#ifdef HAVE_SDL "sdl", +#endif NULL, }; int r; @@ -96,13 +102,15 @@ static int setup_video(til_settings_t *settings, til_setting_t **res_setting, co fb_ops = &drm_fb_ops; return drm_fb_ops.setup(settings, res_setting, res_desc); - } else + } #endif +#ifdef HAVE_SDL if (!strcmp(video, "sdl")) { fb_ops = &sdl_fb_ops; return sdl_fb_ops.setup(settings, res_setting, res_desc); } +#endif return -EINVAL; } -- cgit v1.2.3