Make unitwaittime block exploding a nuke in place.
[freeciv.git] / m4 / sound.m4
blobb2138b6b7b972f4e48409e3d3ab328e1b2791161
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
13   SDL_VERSION=1.0.0
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])
21     SDL_mixer=sdl
22     SOUND_SDL_OK=true
23 ], [
24     ac_save_CPPFLAGS="$CPPFLAGS"
25     ac_save_CFLAGS="$CFLAGS"
26     ac_save_LIBS="$LIBS"
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"
34     LIBS="$ac_save_LIBS"
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])
42         AC_MSG_RESULT([yes])
43         SOUND_SDL_OK=true
44       else
45         AC_MSG_RESULT([no SDL_mixer library found, install from http://www.libsdl.org/projects/SDL_mixer/index.html ])
46       fi
47     else
48       AC_MSG_RESULT([no SDL_mixer headers found, install from http://www.libsdl.org/projects/SDL_mixer/index.html])
49       SDL_mixer=no
50     fi ])
51   fi
52 elif test "x$USE_SOUND_SDL" = "xsdl2" ; then
53   dnl Add SDL support to client
54   SDL2_VERSION=2.0.0
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])
62     SDL_mixer=sdl2
63     SOUND_SDL_OK=true
64 ], [
65     ac_save_CPPFLAGS="$CPPFLAGS"
66     ac_save_CFLAGS="$CFLAGS"
67     ac_save_LIBS="$LIBS"
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"
75     LIBS="$ac_save_LIBS"
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])
83         AC_MSG_RESULT([yes])
84         SOUND_SDL_OK=true
85       else
86         AC_MSG_RESULT([no SDL2_mixer library found, install from http://www.libsdl.org/projects/SDL_mixer/index.html ])
87       fi
88     else
89       AC_MSG_RESULT([no SDL2_mixer headers found, install from http://www.libsdl.org/projects/SDL_mixer/index.html])
90       SDL_mixer=no
91     fi ])
92   fi
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])
97   fi
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
103   SDL_mixer=no