summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@pengaru.com>2020-09-09 15:47:51 -0700
committerVito Caputo <vcaputo@pengaru.com>2020-09-09 15:47:51 -0700
commit42977fb0776f8907435d65de7c6b348c45e1a3e9 (patch)
treed1c3a4999cb35e9177416096289d1eca774c8e5a /configure.ac
parent24ff328c9ce7255dc6f7ff2d3496003f9382c8c3 (diff)
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.
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac20
1 files changed, 18 insertions, 2 deletions
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"
© All Rights Reserved