[Freeciv-Dev] Re: request for --disable-sound
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
On Tue, 2002-06-11 at 12:09, Per I Mathisen wrote:
> On 11 Jun 2002, Davide Pagnin wrote:
> > What is important to me is that such an option, like --disable-sound
> > will be present.
> >
> > And if possible, that selecting that option means don't having annoying
> > messages complaying of stdsound.spec missing or various plugin missing.
>
> The attached patch should fix both issues. Please test. (ie apply, stuff
> the .m4 file in m4/ directory and run ./autogen.sh.)
I've tested your patch, and it seems to work.
I appreciate very much the idea to move all sound stuff in the sound.m4
macro, to eliminate duplication in configure.in/ac.
And more, my solution pollutes every makefile with ENABLE_SOUND and
USE_SOUND defines, instead your in clean.
The part I like less is how you've reworked LOG_LEVEL of freelog
messages. Perhaps it is just a matter of personal taste, but if I'm a
normal user there is a behaviour that may be expected and a behaviour
that may be not expected.
I need to explain better:
1) If I'm aware that something is broken in my operating system when
coped with sound, and I want to avoid any kind of problem. I type
--disable-sound during configure time and then I expect to have
absolutely no problem or complaint from sound system. (If LOG_VERBOSE
enabled, warn that none plugin is selected) ok
2) I'm aware that something is wrong in my terminal and I can't use
sound, it is unlikely but imagine that you're connected to a remote host
and that you start civclient on the remote host, with the display
configured to the local host, sound isn't a viable option in this case,
(not an easy at minimum). I selected the none plugin via the --Plugin
none client option and I pretend to not having any kind of problem with
the sound system nor complaining of missing libraries or files. (If
LOG_VERBOSE enabled, warn that plugin none is selected)
3) I choose a prefered plugin but that plugin isn't found, I think that
freeciv in this case has to issue a FATAL freelog error and exit from
execution, listing the available plugin
4) I choose a prefered plugin but that plugin isn't initializable, in
this case there a reasonable answer that the system may give is: Normal
error, warn that sound is disabled and none plugin is loaded. No other
complaint of wrong or missing files.
5) In the case of no prefered plugin:
a) write (LOG_VERBOSE) which type of plugin has been loaded.
b) If no plugin other than none is available, write (LOG NORMAL) good
advice on how to found sound libraries
c) If no plugin other than none is initializable, write (LOG_ERROR) the
bad status and proceed with disabled sound.
I attach a partial patch, that tries to implement the above behaviour,
but is incomplete, I'll finish tomorrow.
I've also noticed that sound.m4 is not in the EXTRA_DIST field of
Makefile.am, perhaps something forgotten?
Ciao, Davide
> Yours,
> Per
>
> "It is difficult to catch a black cat in a dark room.
> Especially if there is no cat there." - Confucius
> ----
>
> ? m4/sound.m4
> Index: configure.ac
> ===================================================================
> RCS file: /home/freeciv/CVS/freeciv/configure.ac,v
> retrieving revision 1.9
> diff -u -r1.9 configure.ac
> --- configure.ac 2002/06/09 17:54:25 1.9
> +++ configure.ac 2002/06/11 09:52:12
> @@ -489,45 +489,9 @@
> AC_MSG_ERROR(could not guess which client to compile)
> fi
>
> - dnl Add esound support to client
> - ESD_VERSION=0.0.20
> - AM_PATH_ESD($ESD_VERSION, :, ESD=no)
> - if test "x$ESD" != "xno"; then
> - SOUND_CFLAGS="$SOUND_CFLAGS $ESD_CFLAGS"
> - SOUND_LIBS="$SOUND_LIBS $ESD_LIBS"
> - AC_DEFINE(ESD, 1, [Esound support])
> - AC_MSG_CHECKING(building ESOUND support)
> - AC_MSG_RESULT(yes)
> - fi
> + dnl Check for sound support, sets SOUND_CFLAGS, SOUND_LIBS, ESD, SDL &
> WINMM
> + FC_CHECK_SOUND()
>
> - dnl Add SDL support to client
> - SDL_VERSION=1.0.0
> - AM_PATH_SDL($SDL_VERSION, :, SDL = no)
> - if test "x$SDL" != "xno"; then
> - AC_CHECK_HEADER(SDL/SDL_mixer.h, SDL_mixer_h=1, SDL_mixer_h=0)
> - AC_CHECK_LIB(SDL_mixer, Mix_OpenAudio, SDL_mixer=yes)
> - AC_MSG_CHECKING(building SDL_mixer support)
> - if test "x$SDL_mixer_h" = "x1"; then
> - if test "x$SDL_mixer" = "xyes"; then
> - SOUND_CFLAGS="$SOUND_CFLAGS $SDL_CFLAGS"
> - SOUND_LIBS="$SOUND_LIBS $SDL_LIBS -lSDL_mixer"
> - AC_DEFINE(SDL, 1, [SDL_Mixer support])
> - AC_MSG_RESULT(yes)
> - else
> - AC_MSG_RESULT([no, found header but not library!])
> - fi
> - else
> - AC_MSG_RESULT([no, install SDL_mixer first:
> http://www.libsdl.org/projects/SDL_mixer/index.html])
> - fi
> - fi
> -
> - dnl Add WinMM sound support to client
> - if test x"$MINGW32" = "xyes"; then
> - SOUND_LIBS="$SOUND_LIBS -lwinmm"
> - AC_DEFINE(WINMM, 1, [Windows MultiMedia sound support])
> - WINMM="yes"
> - fi
> -
> gui_sources="gui-$client"
> fi
> AC_SUBST(gui_sources)
> @@ -535,9 +499,9 @@
> AC_SUBST(CLIENT_LIBS)
> AC_SUBST(SOUND_CFLAGS)
> AC_SUBST(SOUND_LIBS)
> -AM_CONDITIONAL(ESD, test "$ESD" != "no")
> -AM_CONDITIONAL(SDL, test "$SDL_mixer" = "yes")
> -AM_CONDITIONAL(WINMM, test "$WINMM" = "yes")
> +AM_CONDITIONAL(ESD, test "x$ESD" = "xyes")
> +AM_CONDITIONAL(SDL, test "x$SDL_mixer" = "xyes")
> +AM_CONDITIONAL(WINMM, test "x$WINMM" = "xyes")
> AM_CONDITIONAL(CLIENT_GUI_GTK, test "$gui_sources" = "gui-gtk")
> AM_CONDITIONAL(CLIENT_GUI_GTK_2_0, test "$gui_sources" = "gui-gtk-2.0")
> AM_CONDITIONAL(CLIENT_GUI_XAW, test "$gui_sources" = "gui-xaw")
> Index: configure.in
> ===================================================================
> RCS file: /home/freeciv/CVS/freeciv/configure.in,v
> retrieving revision 1.187
> diff -u -r1.187 configure.in
> --- configure.in 2002/06/09 17:54:25 1.187
> +++ configure.in 2002/06/11 09:52:12
> @@ -483,45 +483,9 @@
> AC_MSG_ERROR(could not guess which client to compile)
> fi
>
> - dnl Add esound support to client
> - ESD_VERSION=0.0.20
> - AM_PATH_ESD($ESD_VERSION, :, ESD=no)
> - if test "x$ESD" != "xno"; then
> - SOUND_CFLAGS="$SOUND_CFLAGS $ESD_CFLAGS"
> - SOUND_LIBS="$SOUND_LIBS $ESD_LIBS"
> - AC_DEFINE(ESD)
> - AC_MSG_CHECKING(building ESOUND support)
> - AC_MSG_RESULT(yes)
> - fi
> + dnl Check for sound support, sets SOUND_CFLAGS, SOUND_LIBS, ESD, SDL &
> WINMM
> + FC_CHECK_SOUND()
>
> - dnl Add SDL support to client
> - SDL_VERSION=1.0.0
> - AM_PATH_SDL($SDL_VERSION, :, SDL = no)
> - if test "x$SDL" != "xno"; then
> - AC_CHECK_HEADER(SDL/SDL_mixer.h, SDL_mixer_h=1, SDL_mixer_h=0)
> - AC_CHECK_LIB(SDL_mixer, Mix_OpenAudio, SDL_mixer=yes)
> - AC_MSG_CHECKING(building SDL_mixer support)
> - if test "x$SDL_mixer_h" = "x1"; then
> - if test "x$SDL_mixer" = "xyes"; then
> - SOUND_CFLAGS="$SOUND_CFLAGS $SDL_CFLAGS"
> - SOUND_LIBS="$SOUND_LIBS $SDL_LIBS -lSDL_mixer"
> - AC_DEFINE(SDL)
> - AC_MSG_RESULT(yes)
> - else
> - AC_MSG_RESULT([no, found header but not library!])
> - fi
> - else
> - AC_MSG_RESULT([no, install SDL_mixer first:
> http://www.libsdl.org/projects/SDL_mixer/index.html])
> - fi
> - fi
> -
> - dnl Add WinMM sound support to client
> - if test x"$MINGW32" = "xyes"; then
> - SOUND_LIBS="$SOUND_LIBS -lwinmm"
> - AC_DEFINE(WINMM)
> - WINMM="yes"
> - fi
> -
> gui_sources="gui-$client"
> fi
> AC_SUBST(gui_sources)
> @@ -529,9 +493,9 @@
> AC_SUBST(CLIENT_LIBS)
> AC_SUBST(SOUND_CFLAGS)
> AC_SUBST(SOUND_LIBS)
> -AM_CONDITIONAL(ESD, test "$ESD" != "no")
> -AM_CONDITIONAL(SDL, test "$SDL_mixer" = "yes")
> -AM_CONDITIONAL(WINMM, test "$WINMM" = "yes")
> +AM_CONDITIONAL(ESD, test x"$ESD" = "xyes")
> +AM_CONDITIONAL(SDL, test x"$SDL_mixer" = "xyes")
> +AM_CONDITIONAL(WINMM, test x"$WINMM" = "xyes")
> AM_CONDITIONAL(CLIENT_GUI_GTK, test "$gui_sources" = "gui-gtk")
> AM_CONDITIONAL(CLIENT_GUI_GTK_2_0, test "$gui_sources" = "gui-gtk-2.0")
> AM_CONDITIONAL(CLIENT_GUI_XAW, test "$gui_sources" = "gui-xaw")
> Index: client/audio.c
> ===================================================================
> RCS file: /home/freeciv/CVS/freeciv/client/audio.c,v
> retrieving revision 1.7
> diff -u -r1.7 audio.c
> --- client/audio.c 2002/05/24 07:59:05 1.7
> +++ client/audio.c 2002/06/11 09:52:14
> @@ -80,19 +80,19 @@
> }
>
> if (!found) {
> - freelog(LOG_ERROR,
> + freelog(LOG_VERBOSE,
> _("Plugin '%s' isn't available. Available are %s"), name,
> audio_get_all_plugin_names());
> return FALSE;
> }
>
> if (!plugins[i].init()) {
> - freelog(LOG_ERROR, _("Plugin found but can't be initialized."));
> + freelog(LOG_VERBOSE, _("Plugin %s found but can't be initialized."),
> name);
> return FALSE;
> }
>
> selected_plugin = i;
> - freelog(LOG_NORMAL, _("Plugin '%s' is now selected"),
> + freelog(LOG_VERBOSE, _("Sound plugin '%s' is now selected"),
> plugins[selected_plugin].name);
> return TRUE;
> }
> @@ -127,6 +127,11 @@
> char *filename, *file_capstr;
> char us_capstr[] = "+soundspec";
>
> + if (num_plugins_used == 1) {
> + /* We only have the dummy plugin, so silenty skip the below */
> + tagfile = NULL;
> + return;
> + }
> if (!spec_name) {
> freelog(LOG_FATAL, _("No audio ruleset given!"));
> exit(EXIT_FAILURE);
> ----
>
> AC_DEFUN(FC_CHECK_SOUND,[
> AC_ARG_ENABLE(sound,
> [ --disable-sound Do not use sound support],
> USE_SOUND=$enableval, USE_SOUND=yes)
>
> if test "x$USE_SOUND" = "xyes"; then
>
> dnl Add esound support to client
> ESD_VERSION=0.0.20
> AM_PATH_ESD($ESD_VERSION, ESD=yes, ESD=no)
> if test "x$ESD" != "xno"; then
> SOUND_CFLAGS="$SOUND_CFLAGS $ESD_CFLAGS"
> SOUND_LIBS="$SOUND_LIBS $ESD_LIBS"
> AC_DEFINE(ESD, 1, [Esound support])
> AC_MSG_CHECKING(building ESOUND support)
> AC_MSG_RESULT(yes)
> fi
>
> dnl Add SDL support to client
> SDL_VERSION=1.0.0
> AM_PATH_SDL($SDL_VERSION, SDL=yes, SDL=no)
> if test "x$SDL" != "xno"; then
> AC_CHECK_HEADER(SDL/SDL_mixer.h, SDL_mixer_h=1, SDL_mixer_h=0)
> AC_CHECK_LIB(SDL_mixer, Mix_OpenAudio, SDL_mixer=yes)
> AC_MSG_CHECKING(building SDL_mixer support)
> if test "x$SDL_mixer_h" = "x1"; then
> if test "x$SDL_mixer" = "xyes"; then
> SOUND_CFLAGS="$SOUND_CFLAGS $SDL_CFLAGS"
> SOUND_LIBS="$SOUND_LIBS $SDL_LIBS -lSDL_mixer"
> AC_DEFINE(SDL, 1, [SDL_Mixer support])
> AC_MSG_RESULT(yes)
> else
> AC_MSG_RESULT([no, found header but not library!])
> fi
> else
> AC_MSG_RESULT([no, install SDL_mixer first:
> http://www.libsdl.org/projects/SDL_mixer/index.html])
> fi
> fi
> dnl Add WinMM sound support to client
> if test x"$MINGW32" = "xyes"; then
> SOUND_LIBS="$SOUND_LIBS -lwinmm"
> AC_DEFINE(WINMM, 1, [Windows MultiMedia sound support])
> WINMM="yes"
> fi
>
> fi
> ])
disable-sound.patch
Description: Text Data
- [Freeciv-Dev] Re: request for --disable-sound, (continued)
[Freeciv-Dev] Re: request for --disable-sound, Davide Pagnin, 2002/06/11
[Freeciv-Dev] Re: request for --disable-sound, Raimar Falke, 2002/06/11
[Freeciv-Dev] Re: request for --disable-sound, Davide Pagnin, 2002/06/13
|
|