1 AC_DEFUN([FC_CHECK_SOUND],[
2 AC_ARG_ENABLE([sdl-mixer],
3 AS_HELP_STRING([--enable-sdl-mixer], [use the SDL mixer [sdl2]]),
4 [case "${enableval}" in
5 no) USE_SOUND_SDL=no ;;
6 yes|sdl|sdl2) USE_SOUND_SDL=sdl2 ;;
7 *) AC_MSG_ERROR([bad value ${enableval} for --enable-sdl-mixer]) ;;
8 esac], [USE_SOUND_SDL=maybe])
10 if test "x$USE_SOUND_SDL" != "xno" ; then
11 dnl Add SDL2-mixer support to client
13 AM_PATH_SDL2($SDL2_VERSION, SDL2=yes, SDL2=no)
14 if test "x$SDL2" != "xno"; then
15 PKG_CHECK_MODULES([SDL2MIXER], [SDL2_mixer],
17 SOUND_CFLAGS="$SOUND_CFLAGS $SDL2MIXER_CFLAGS"
18 SOUND_LIBS="$SOUND_LIBS $SDL2MIXER_LIBS"
19 AC_DEFINE([AUDIO_SDL], [1], [SDL Mixer support])
20 AC_DEFINE([AUDIO_SDL2], [1], [SDL-2 Mixer in use])
23 if test x$sdl_headers_without_path != xyes ; then
24 AC_CHECK_HEADER([SDL2/SDL_mixer.h], [], [
25 AC_DEFINE([SDL2_PLAIN_INCLUDE], [1], [sdl2 headers must be included without path])
26 sdl_headers_without_path=yes])
29 ac_save_CPPFLAGS="$CPPFLAGS"
30 ac_save_CFLAGS="$CFLAGS"
32 CPPFLAGS="$CPPFLAGS $SDL2_CFLAGS"
33 CFLAGS="$CFLAGS $SDL2_CFLAGS"
34 LIBS="$LIBS $SDL2_LIBS"
35 AC_CHECK_HEADER([SDL_mixer.h], [SDL_mixer_h=1], [SDL_mixer_h=0])
36 AC_CHECK_LIB([SDL2_mixer], [Mix_OpenAudio], [SDL_mixer=sdl2])
37 CPPFLAGS="$ac_save_CPPFLAGS"
38 CFLAGS="$ac_save_CFLAGS"
41 AC_MSG_CHECKING([building SDL2_mixer support])
42 if test "x$SDL_mixer_h" = "x1"; then
43 if test "x$SDL_mixer" = "xsdl2"; then
44 SOUND_CFLAGS="$SOUND_CFLAGS $SDL2_CFLAGS"
45 SOUND_LIBS="$SOUND_LIBS -lSDL2_mixer $SDL2_LIBS"
46 AC_DEFINE([AUDIO_SDL], [1], [SDL Mixer support])
47 AC_DEFINE([AUDIO_SDL2], [1], [SDL-2 Mixer in use])
51 AC_MSG_RESULT([no SDL2_mixer library found, install from http://www.libsdl.org/projects/SDL_mixer/index.html ])
54 AC_MSG_RESULT([no SDL2_mixer headers found, install from http://www.libsdl.org/projects/SDL_mixer/index.html])
59 if test "x$USE_SOUND_SDL" = "xsdl2" ;then
60 if test "x$SOUND_SDL_OK" != "xtrue" ; then
61 AC_MSG_ERROR([SDL mixer support requested, but cannot be compiled in])
64 if test "x$USE_SOUND_SDL" = "xmaybe" && test "x$SOUND_SDL_OK" != "xtrue" ; then
67 if test "x$SDL_mixer" = "x" ; then