1 AC_DEFUN([FC_CHECK_SOUND],[
2 AC_ARG_ENABLE([sdl-mixer],
3 AS_HELP_STRING([--enable-sdl-mixer], [use the SDL mixer [sdl]]),
4 [case "${enableval}" in
5 yes|sdl) USE_SOUND_SDL=sdl ;;
6 no) USE_SOUND_SDL=no ;;
7 sdl2) USE_SOUND_SDL=sdl2 ;;
8 *) AC_MSG_ERROR([bad value ${enableval} for --enable-sdl-mixer]) ;;
9 esac], [USE_SOUND_SDL=maybe])
11 if test "x$USE_SOUND_SDL" != "xno" && test "x$USE_SOUND_SDL" != "xsdl2" ; then
12 dnl Add SDL support to client
14 AM_PATH_SDL($SDL_VERSION, SDL=yes, SDL=no)
15 if test "x$SDL" != "xno"; then
16 PKG_CHECK_MODULES([SDLMIXER], [SDL_mixer],
18 SOUND_CFLAGS="$SOUND_CFLAGS $SDLMIXER_CFLAGS"
19 SOUND_LIBS="$SOUND_LIBS $SDLMIXER_LIBS"
20 AC_DEFINE([AUDIO_SDL], [1], [SDL_Mixer support])
24 ac_save_CPPFLAGS="$CPPFLAGS"
25 ac_save_CFLAGS="$CFLAGS"
27 CPPFLAGS="$CPPFLAGS $SDL_CFLAGS"
28 CFLAGS="$CFLAGS $SDL_CFLAGS"
29 LIBS="$LIBS $SDL_LIBS"
30 AC_CHECK_HEADER([SDL_mixer.h], [SDL_mixer_h=1], [SDL_mixer_h=0])
31 AC_CHECK_LIB([SDL_mixer], [Mix_OpenAudio], [SDL_mixer=sdl])
32 CPPFLAGS="$ac_save_CPPFLAGS"
33 CFLAGS="$ac_save_CFLAGS"
36 AC_MSG_CHECKING([building SDL_mixer support])
37 if test "x$SDL_mixer_h" = "x1"; then
38 if test "x$SDL_mixer" = "xsdl"; then
39 SOUND_CFLAGS="$SOUND_CFLAGS $SDL_CFLAGS"
40 SOUND_LIBS="$SOUND_LIBS -lSDL_mixer $SDL_LIBS"
41 AC_DEFINE([AUDIO_SDL], [1], [SDL_Mixer support])
45 AC_MSG_RESULT([no SDL_mixer library found, install from http://www.libsdl.org/projects/SDL_mixer/index.html ])
48 AC_MSG_RESULT([no SDL_mixer headers found, install from http://www.libsdl.org/projects/SDL_mixer/index.html])
52 elif test "x$USE_SOUND_SDL" = "xsdl2" ; then
53 dnl Add SDL support to client
55 AM_PATH_SDL2($SDL2_VERSION, SDL2=yes, SDL2=no)
56 if test "x$SDL2" != "xno"; then
57 PKG_CHECK_MODULES([SDL2MIXER], [SDL2_mixer],
59 SOUND_CFLAGS="$SOUND_CFLAGS $SDL2MIXER_CFLAGS"
60 SOUND_LIBS="$SOUND_LIBS $SDL2MIXER_LIBS"
61 AC_DEFINE([AUDIO_SDL], [1], [SDL2_Mixer support])
65 ac_save_CPPFLAGS="$CPPFLAGS"
66 ac_save_CFLAGS="$CFLAGS"
68 CPPFLAGS="$CPPFLAGS $SDL2_CFLAGS"
69 CFLAGS="$CFLAGS $SDL2_CFLAGS"
70 LIBS="$LIBS $SDL2_LIBS"
71 AC_CHECK_HEADER([SDL_mixer.h], [SDL_mixer_h=1], [SDL_mixer_h=0])
72 AC_CHECK_LIB([SDL2_mixer], [Mix_OpenAudio], [SDL_mixer=sdl2])
73 CPPFLAGS="$ac_save_CPPFLAGS"
74 CFLAGS="$ac_save_CFLAGS"
77 AC_MSG_CHECKING([building SDL2_mixer support])
78 if test "x$SDL_mixer_h" = "x1"; then
79 if test "x$SDL_mixer" = "xsdl2"; then
80 SOUND_CFLAGS="$SOUND_CFLAGS $SDL2_CFLAGS"
81 SOUND_LIBS="$SOUND_LIBS -lSDL2_mixer $SDL2_LIBS"
82 AC_DEFINE([AUDIO_SDL], [1], [SDL_Mixer support])
86 AC_MSG_RESULT([no SDL2_mixer library found, install from http://www.libsdl.org/projects/SDL_mixer/index.html ])
89 AC_MSG_RESULT([no SDL2_mixer headers found, install from http://www.libsdl.org/projects/SDL_mixer/index.html])
94 if test "x$USE_SOUND_SDL" = "xsdl" || test "x$USE_SOUND_SDL" = "xsdl2" ;then
95 if test "x$SOUND_SDL_OK" != "xtrue" ; then
96 AC_MSG_ERROR([SDL mixer support requested, but cannot be compiled in])
99 if test "x$USE_SOUND_SDL" = "xmaybe" && test "x$SOUND_SDL_OK" != "xtrue" ; then
100 feature_sound=missing
102 if test "x$SDL_mixer" = "x" ; then