From 42977fb0776f8907435d65de7c6b348c45e1a3e9 Mon Sep 17 00:00:00 2001 From: Vito Caputo Date: Wed, 9 Sep 2020 15:47:51 -0700 Subject: configure: implement --with-audio=(no|yes) This adds the ability to turn off the audio/music parts of the API, removing the SDL2_Mixer dependency when disabled. It will also automatically disable the audio/music parts of the API when SDL2_Mixer isn't detected @ configure time and --with-audio was unspecified. It's a bit ugly with a bunch of #ifdef's in play.c, oh well. --- configure.ac | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index 3855060..539fa19 100644 --- a/configure.ac +++ b/configure.ac @@ -14,8 +14,24 @@ PKG_CHECK_MODULES(SDL2, sdl2) CFLAGS="$CFLAGS $SDL2_CFLAGS" LIBS="$LIBS $SDL2_LIBS" -dnl Check for SDL2_mixer -PKG_CHECK_MODULES(SDL2_MIXER, SDL2_mixer) +dnl Check for SDL2_mixer unless --with-audio=no, fails when missing and --with-audio=yes +AC_ARG_WITH( + [audio], + [AS_HELP_STRING([--with-audio], [Enable audio/music API via SDL2_mixer @<:@default=check@:>@])], + [], + [with_audio=check]) + +AS_CASE( + ["$with_audio"], + [yes], [PKG_CHECK_MODULES(SDL2_MIXER, SDL2_mixer, [HAVE_MIXER=1])], + [no], [HAVE_MIXER=0], + [PKG_CHECK_MODULES(SDL2_MIXER, SDL2_mixer, [HAVE_MIXER=1], [HAVE_MIXER=0])]) + +dnl this gets the define for compilation +AS_IF([test "x$HAVE_MIXER" = x1], [AC_DEFINE([WITH_AUDIO],[],[Enable audio/music API])]) +dnl this gets the define for Makefile.am +AM_CONDITIONAL([WITH_AUDIO], [test "x$HAVE_MIXER" = x1]) + LIBS="$SDL2_MIXER_LIBS $LIBS" CFLAGS="$SDL2_MIXER_CFLAGS $CFLAGS" -- cgit v1.2.3