Skip to content
Permalink
Browse files

Sam Lantinga - Sat Oct 3 13:33:36 PDT 2009

 * MOD support uses libmikmod and is dynamically loaded by default
  • Loading branch information
slouken committed Oct 3, 2009
1 parent b4bc207 commit 9537a2f5693b3f722ecec85750e8e55cafc4e425
@@ -1,4 +1,6 @@
1.2.9:
Sam Lantinga - Sat Oct 3 13:33:36 PDT 2009
* MOD support uses libmikmod and is dynamically loaded by default
Sam Lantinga - Sat Oct 3 02:49:41 PDT 2009
* Added TIMIDITY_CFG environment variable to fully locate timidity.cfg
O.Sezer - 2009-10-02 08:41:50 PDT
@@ -152,66 +152,84 @@ if test x$enable_music_cmd = xyes; then
SOURCES="$SOURCES $srcdir/music_cmd.c"
EXTRA_CFLAGS="$EXTRA_CFLAGS -DCMD_MUSIC"
fi

AC_ARG_ENABLE([music-wave],
AC_HELP_STRING([--enable-music-wave], [enable streaming WAVE music [[default=yes]]]),
[], [enable_music_wave=yes])
if test x$enable_music_wave = xyes; then
SOURCES="$SOURCES $srcdir/wavestream.c"
EXTRA_CFLAGS="$EXTRA_CFLAGS -DWAV_MUSIC"
fi
no_libmikmod=yes
libmikmod_maj=3
libmikmod_min=1
libmikmod_rev=10
libmikmod_ver="$libmikmod_maj.$libmikmod_min.$libmikmod_rev"
AC_ARG_ENABLE([music-libmikmod],
AC_HELP_STRING([--enable-music-libmikmod], [enable MOD music via external libmikmod [[default=no]]]),
[], [enable_music_libmikmod=no])
if test x$enable_music_libmikmod = xyes; then

AC_ARG_ENABLE([music-mod],
AC_HELP_STRING([--enable-music-mod], [enable MOD music via mikmod [[default=yes]]]),
[], [enable_music_mod=yes])
AC_ARG_ENABLE([music-mod-shared],
AC_HELP_STRING([--enable-music-mod-shared], [dynamically load MOD support [[default=yes]]]),
[], [enable_music_mod_shared=yes])
if test x$enable_music_mod = xyes; then
have_libmikmod=no
libmikmod_maj=3
libmikmod_min=1
libmikmod_rev=10
libmikmod_ver="$libmikmod_maj.$libmikmod_min.$libmikmod_rev"
AC_PATH_PROG(LIBMIKMOD_CONFIG, libmikmod-config, no, [$PATH])
if test "$LIBMIKMOD_CONFIG" != "no" ; then
no_libmikmod=no

CFLAGS_SAVED="$CFLAGS"
LIBS_SAVED="$LIBS"
CFLAGS="$CFLAGS -DLIBMIKMOD_MUSIC `$LIBMIKMOD_CONFIG --cflags`"
LIBS="$LIBS `$LIBMIKMOD_CONFIG --libs`"
have_libmikmod=yes
AC_MSG_CHECKING([for libmikmod - version >= $libmikmod_ver])
AC_TRY_RUN([
#include "mikmod.h"
#include "stdio.h"

int main(int argc, char **argv)
{
long maj=$libmikmod_maj,min=$libmikmod_min,rev=$libmikmod_rev,ver=MikMod_GetVersion();
/*printf("(%d.%d.%d) ",ver>>16,(ver>>8)&0xff,ver&0xff);*/
if(ver>=((maj<<16)|(min<<8)|(rev))) {
printf("yes\n");
return 0;
}
printf("no\n*** libmikmod is older than %d.%d.%d, not using.\n",maj,min,rev);
return 1;
long maj=$libmikmod_maj,min=$libmikmod_min,rev=$libmikmod_rev,ver=MikMod_GetVersion();
/*printf("(%d.%d.%d) ",ver>>16,(ver>>8)&0xff,ver&0xff);*/
if(ver>=((maj<<16)|(min<<8)|(rev))) {
printf("yes\n");
return 0;
}
printf("no\n*** libmikmod is older than %d.%d.%d, not using.\n",maj,min,rev);
return 1;
}
], , , [echo $ac_n "cross compiling; assumed OK... $ac_c"])
], [], have_libmikmod=no; CFLAGS="$CFLAGS_SAVED"; LIBS="$LIBS_SAVED",
[echo $ac_n "cross compiling; assumed OK... $ac_c"])
fi
CFLAGS="$CFLAGS_SAVED"
LIBS="$LIBS_SAVED"
fi

AC_ARG_ENABLE([music-mod],
AC_HELP_STRING([--enable-music-mod], [enable MOD music via mikmod [[default=yes]]]),
[], [enable_music_mod=yes])
if test x$enable_music_mod = xyes; then
EXTRA_CFLAGS="$EXTRA_CFLAGS -DMOD_MUSIC"
SOURCES="$SOURCES $srcdir/music_mod.c"

if test x$enable_music_libmikmod = xyes; then
EXTRA_CFLAGS="$EXTRA_CFLAGS -DLIBMIKMOD_MUSIC `$LIBMIKMOD_CONFIG --cflags`"
EXTRA_LDFLAGS="$EXTRA_LDFLAGS `$LIBMIKMOD_CONFIG --libs`"
if test x$have_libmikmod = xyes; then
case "$host" in
*-*-darwin*)
mikmod_lib=[`find_lib libmikmod*.dylib`]
;;
*-*-cygwin* | *-*-mingw32*)
mikmod_lib=[`find_lib "mikmod*.dll"`]
;;
*)
mikmod_lib=[`find_lib "libmikmod*.so.[0-9]"`]
if test x$mikmod_lib = x; then
mikmod_lib=[`find_lib "libmikmod*.so.[0-9]*"`]
fi
;;
esac
SOURCES="$SOURCES $srcdir/*_mod.c"
EXTRA_CFLAGS="$EXTRA_CFLAGS -DMOD_MUSIC `$LIBMIKMOD_CONFIG --cflags`"
if test x$enable_music_mod_shared = xyes && test x$mikmod_lib != x; then
echo "-- dynamic libmikmod -> $mikmod_lib"
EXTRA_CFLAGS="$EXTRA_CFLAGS -DMOD_DYNAMIC=\\\"$mikmod_lib\\\""
else
EXTRA_LDFLAGS="$EXTRA_LDFLAGS `$LIBMIKMOD_CONFIG --libs`"
fi
else
EXTRA_CFLAGS="$EXTRA_CFLAGS -I\$(srcdir)/mikmod"
SOURCES="$SOURCES $srcdir/mikmod/*.c"
AC_MSG_WARN([*** Unable to find MikMod library (http://mikmod.raphnet.net/)])
AC_MSG_WARN([MOD support disabled])
fi
fi

AC_ARG_ENABLE([music-midi],
AC_HELP_STRING([--enable-music-midi], [enable MIDI music via timidity [[default=yes]]]),
[], [enable_music_midi=yes])
@@ -262,11 +280,12 @@ AC_HELP_STRING([--enable-music-native-midi-gpl], [enable native MIDI on UNIX usi
fi
fi
fi

AC_ARG_ENABLE([music-ogg],
AC_HELP_STRING([--enable-music-ogg], [enable Ogg Vorbis music [[default=yes]]]),
[], [enable_music_ogg=yes])
AC_ARG_ENABLE(music-ogg-tremor,
[ --enable-music-ogg-tremor enable OGG music via libtremor [[default=no]]],
AC_HELP_STRING([--enable-music-ogg-tremor], [enable OGG Vorbis music via libtremor [[default=no]]]),
[], enable_music_ogg_tremor=no)
AC_ARG_ENABLE([music-ogg-shared],
AC_HELP_STRING([--enable-music-ogg-shared], [dynamically load Ogg Vorbis support [[default=yes]]]),
@@ -304,6 +323,9 @@ if test x$enable_music_ogg = xyes; then
else
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lvorbisidec"
fi
else
AC_MSG_WARN([*** Unable to find Ogg Vorbis Tremor library (http://www.xiph.org/)])
AC_MSG_WARN([Ogg Vorbis support disabled])
fi
else
AC_CHECK_HEADER([vorbis/vorbisfile.h], [have_ogg_hdr=yes])
@@ -331,9 +353,13 @@ if test x$enable_music_ogg = xyes; then
else
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lvorbisfile -lvorbis -logg"
fi
else
AC_MSG_WARN([*** Unable to find Ogg Vorbis library (http://www.xiph.org/)])
AC_MSG_WARN([Ogg Vorbis support disabled])
fi
fi
fi

libflac_ver=8
AC_ARG_ENABLE([music-flac],
AC_HELP_STRING([--enable-music-flac], [enable FLAC music [[default=yes]]]),
@@ -359,50 +385,53 @@ int main( int argc, char *argv[] ) {
#endif
}
], have_flac_ver=yes, have_flac_ver=no)
LIBS="$LIBS_SAVED"
AC_MSG_RESULT($have_flac_ver)
if test x$have_flac_ver = xno; then
echo "*** FLAC support has been disabled."
else
AC_CHECK_HEADER([FLAC/stream_decoder.h], [have_flac_hdr=yes])
AC_CHECK_LIB([FLAC], [FLAC__stream_decoder_new], [have_flac_lib=yes])
if test x$have_flac_hdr = xyes -a x$have_flac_lib = xyes; then
case "$host" in
*-*-darwin*)
flac_lib=[`find_lib FLAC*.dylib`]
;;
*-*-cygwin* | *-*-mingw32*)
flac_lib=[`find_lib "libFLAC*.dll"`]
;;
*)
flac_lib=[`find_lib "libFLAC.so.[0-9]"`]
if test x$flac_lib = x; then
flac_lib=[`find_lib "libFLAC.so.[0-9]*"`]
fi
;;
esac
SOURCES="$SOURCES $srcdir/*_flac.c"
EXTRA_CFLAGS="$EXTRA_CFLAGS -DFLAC_MUSIC"
if test x$enable_music_flac_shared = xyes && test x$flac_lib != x; then
echo "-- dynamic libFLAC -> $flac_lib"
EXTRA_CFLAGS="$EXTRA_CFLAGS -DFLAC_DYNAMIC=\\\"$flac_lib\\\""
else
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lFLAC"
fi
fi
fi
fi
LIBS="$LIBS_SAVED"
AC_MSG_RESULT($have_flac_ver)
fi

if test x$have_flac_ver = xyes; then
AC_CHECK_HEADER([FLAC/stream_decoder.h], [have_flac_hdr=yes])
AC_CHECK_LIB([FLAC], [FLAC__stream_decoder_new], [have_flac_lib=yes])
if test x$have_flac_hdr = xyes -a x$have_flac_lib = xyes; then
case "$host" in
*-*-darwin*)
flac_lib=[`find_lib libFLAC*.dylib`]
;;
*-*-cygwin* | *-*-mingw32*)
flac_lib=[`find_lib "libFLAC*.dll"`]
;;
*)
flac_lib=[`find_lib "libFLAC.so.[0-9]"`]
if test x$flac_lib = x; then
flac_lib=[`find_lib "libFLAC.so.[0-9]*"`]
fi
;;
esac
SOURCES="$SOURCES $srcdir/*_flac.c"
EXTRA_CFLAGS="$EXTRA_CFLAGS -DFLAC_MUSIC"
if test x$enable_music_flac_shared = xyes && test x$flac_lib != x; then
echo "-- dynamic libFLAC -> $flac_lib"
EXTRA_CFLAGS="$EXTRA_CFLAGS -DFLAC_DYNAMIC=\\\"$flac_lib\\\""
else
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lFLAC"
fi
fi
else
AC_MSG_WARN([*** Unable to find FLAC library (http://flac.sourceforge.net/)])
AC_MSG_WARN([FLAC support disabled])
fi
fi

AC_ARG_ENABLE(music-mp3,
[ --enable-music-mp3 enable MP3 music via smpeg [[default=yes]]],
, enable_music_mp3=yes)
AC_HELP_STRING([--enable-music-mp3], [enable MP3 music via smpeg [[default=yes]]]),
[], enable_music_mp3=yes)
AC_ARG_ENABLE([music-mp3-shared],
AC_HELP_STRING([--enable-music-mp3-shared], [dynamically load MP3 support [[default=yes]]]),
[], [enable_music_mp3_shared=yes])
if test x$enable_music_mp3 = xyes; then
SMPEG_VERSION=0.4.3
AM_PATH_SMPEG($SMPEG_VERSION, have_smpeg=yes, have_smpeg=no)
if test x$have_smpeg = xyes; then
AC_ARG_ENABLE([music-mp3-shared],
AC_HELP_STRING([--enable-music-mp3-shared], [dynamically load MP3 support [[default=yes]]]),
[], [enable_music_mp3_shared=yes])
case "$host" in
*-*-darwin*)
smpeg_lib=[`find_lib libsmpeg*.dylib`]
@@ -425,8 +454,11 @@ AC_HELP_STRING([--enable-music-mp3-shared], [dynamically load MP3 support [[defa
else
EXTRA_LDFLAGS="$EXTRA_LDFLAGS $SMPEG_LIBS"
fi
else
AC_MSG_WARN([*** Unable to find SMPEG library (http://icculus.org/smpeg/)])
fi
fi

AC_ARG_ENABLE(music-mp3-mad-gpl,
AC_HELP_STRING([--enable-music-mp3-mad-gpl], [enable MP3 music via libmad GPL code [[default=no]]]),
[], [enable_music_mp3_mad_gpl=no])
@@ -444,9 +476,15 @@ if test x$enable_music_mp3_mad_gpl = xyes; then
SOURCES="$SOURCES $srcdir/music_mad.c"
EXTRA_CFLAGS="$EXTRA_CFLAGS -DMP3_MAD_MUSIC"
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lmad"
else
AC_MSG_WARN([*** Unable to find MAD library (http://www.underbit.com/products/mad/)])
fi
fi

if test x$have_smpeg != xyes -a x$have_libmad != xyes; then
AC_MSG_WARN([MP3 support disabled])
fi

OBJECTS=`echo $SOURCES | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.lo,g'`
OBJECTS=`echo $OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.rc,$(objects)/\1.o,g'`

0 comments on commit 9537a2f

Please sign in to comment.