[Freeciv-Dev] Re: request for --disable-sound
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Hi all!
I've read of some people having trouble with sound and
I hope that there is general consensus that a --disable-sound
option has to be added to the configuration script.
I've managed to write a macro and made the few changes needed
to have the patch work with configure.in (hope that the
changes to configure.ac works in the way I hope!).
The result is quite good (for my point of view!).
This was mine environment :
A NFS server without sound libraries installed
An exported /usr/local directory to 5 client machine
1 client machine with sound support
4 client machine without sound support
the esound related libraries installed in the
share /usr/local/ directory via a rpm package
This give me some headache, because configure
finds esound stuff and want to use that, afterwords
it finds out that the library related libmme.so
isn't present in the client system (unless the
machine which has the sound support)
With may patch, the client works even for the clients
without sound support.
The patch is rather rough, and obviously need improvement,
the main in related to clean all the messages that the
client spit out saying the lack of stdsound.spec, even
in the case of sound disabled via the --disable-sound
option.
Please, let me know what you think.
Ciao, Davide diff -urN freeciv/Makefile.am freeciv-work/Makefile.am
--- freeciv/Makefile.am Sat May 18 08:31:56 2002
+++ freeciv-work/Makefile.am Tue May 28 16:18:42 2002
@@ -82,6 +82,7 @@
m4/progtest.m4 \
m4/readline.m4 \
m4/sdl.m4 \
+ m4/sound.m4 \
m4/vsnprintf.m4 \
m4/x.213 \
m4/x.252 \
diff -urN freeciv/configure.ac freeciv-work/configure.ac
--- freeciv/configure.ac Fri May 24 08:26:34 2002
+++ freeciv-work/configure.ac Tue May 28 17:09:43 2002
@@ -489,43 +489,47 @@
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
+ AM_WITH_SOUND()
+ dnl Enable sound support to client
+ if test "$USE_SOUND" = "yes"; then
+ 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 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)
+ 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, found header but not library!])
+ AC_MSG_RESULT([no, install SDL_mixer first:
http://www.libsdl.org/projects/SDL_mixer/index.html])
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"
+ 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
gui_sources="gui-$client"
diff -urN freeciv/configure.in freeciv-work/configure.in
--- freeciv/configure.in Fri May 24 08:26:34 2002
+++ freeciv-work/configure.in Tue May 28 17:09:14 2002
@@ -483,43 +483,47 @@
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 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)
+ AM_WITH_SOUND()
+ dnl Whether sound support is requested
+ if test "$USE_SOUND" = "yes"; then
+ 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 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, found header but not library!])
+ AC_MSG_RESULT([no, install SDL_mixer first:
http://www.libsdl.org/projects/SDL_mixer/index.html])
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"
+ dnl Add WinMM sound support to client
+ if test x"$MINGW32" = "xyes"; then
+ SOUND_LIBS="$SOUND_LIBS -lwinmm"
+ AC_DEFINE(WINMM)
+ WINMM="yes"
+ fi
fi
gui_sources="gui-$client"
diff -urN freeciv/m4/sound.m4 freeciv-work/m4/sound.m4
--- freeciv/m4/sound.m4 Thu Jan 1 01:00:00 1970
+++ freeciv-work/m4/sound.m4 Tue May 28 16:01:27 2002
@@ -0,0 +1,73 @@
+# Macro to enable sound support.
+# Davide Pagnin <nightmare@xxxxxxxxxxx>, 2002.
+#
+# This file can be copied and used freely without restrictions. It can
+# be used in projects which are not available under the GNU General Public
+# License or the GNU Library General Public License but which still want
+# to provide support for the GNU gettext functionality.
+# Please note that the actual code of the GNU gettext library is covered
+# by the GNU Library General Public License, and the rest of the GNU
+# gettext package package is covered by the GNU General Public License.
+# They are *not* in the public domain.
+
+# serial 1
+
+dnl This file simply define whether sound checking are requested
+dnl
+AC_DEFUN([AM_WITH_SOUND],
+ [AC_MSG_CHECKING([whether SOUND is requested])
+ dnl Default is enabled SOUND
+ AC_ARG_ENABLE(sound,
+ [ --disable-sound do not use Sound Support],
+ USE_SOUND=$enableval, USE_SOUND=yes)
+ AC_MSG_RESULT($USE_SOUND)
+ AC_SUBST(USE_SOUND)
+
+ SOUND_LIBS=
+ SOUND_CFLAGS=
+ ESD="no"
+ SDL_mixer="no"
+ WINMM="no"
+
+ if test "$USE_SOUND" = "yes"; then
+ AC_DEFINE(ENABLE_SOUND, 1,
+ [Define to 1 if sound support is enabled.])
+ fi
+ AC_OUTPUT_COMMANDS(
+ [for ac_file in $CONFIG_FILES; do
+ # Support "outfile[:infile[:infile...]]"
+ case "$ac_file" in
+ *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
+ esac
+ # PO directories have a Makefile.in generated from Makefile.in.in.
+ case "$ac_file" in */Makefile.in)
+ # Adjust a relative srcdir.
+ ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'`
+ ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`"
+ ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'`
+ # In autoconf-2.13 it is called $ac_given_srcdir.
+ # In autoconf-2.50 it is called $srcdir.
+ test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir"
+ case "$ac_given_srcdir" in
+ .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;;
+ /*) top_srcdir="$ac_given_srcdir" ;;
+ *) top_srcdir="$ac_dots$ac_given_srcdir" ;;
+ esac
+ if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then
+ rm -f "$ac_dir/POTFILES"
+ test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" ||
echo "creating $ac_dir/POTFILES"
+ sed -e "/^#/d" -e "/^[ ]*\$/d" -e "s,.*, $top_srcdir/&
\\\\," -e "\$s/\(.*\) \\\\/\1/" < "$ac_given_srcdir/$ac_dir/POTFILES.in" >
"$ac_dir/POTFILES"
+ test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" ||
echo "creating $ac_dir/Makefile"
+ sed -e "/POTFILES =/r $ac_dir/POTFILES" "$ac_dir/Makefile.in" >
"$ac_dir/Makefile"
+ fi
+ ;;
+ esac
+ done])
+
+ dnl Make all variables we use known to autoconf
+ AC_SUBST(SOUND_LIBS)
+ AC_SUBST(SOUND_CFLAGS)
+ AC_SUBST(ESD)
+ AC_SUBST(SDL_mixer)
+ AC_SUBST(WINMM)
+ ])
|
|