Skip to content

Commit

Permalink
* Improved detection of Ogg Vorbis and Tremor libraries
Browse files Browse the repository at this point in the history
* Added version.rc to the Windows build
  • Loading branch information
slouken committed Jul 18, 2007
1 parent 5f64dd8 commit 4974e93
Show file tree
Hide file tree
Showing 5 changed files with 181 additions and 96 deletions.
2 changes: 2 additions & 0 deletions CHANGES
@@ -1,4 +1,6 @@
1.2.8:
Sam Lantinga - Wed Jul 18 09:45:54 PDT 2007
* Improved detection of Ogg Vorbis and Tremor libraries
Ryan Gordon - Sun Jul 15 12:03:54 EDT 2007
* Fixed memory leaks in Effects API.
David Rose - Sat Jul 14 22:16:09 PDT 2007
Expand Down
3 changes: 2 additions & 1 deletion Makefile.in
Expand Up @@ -28,14 +28,15 @@ LIBTOOL = @LIBTOOL@
INSTALL = @INSTALL@
AR = @AR@
RANLIB = @RANLIB@
WINDRES = @WINDRES@
SDL_CFLAGS = @SDL_CFLAGS@
SDL_LIBS = @SDL_LIBS@

TARGET = libSDL_mixer.la
SOURCES = @SOURCES@
OBJECTS = @OBJECTS@

DIST = CHANGES COPYING CWProjects.sea.bin MPWmake.sea.bin Makefile.in README SDL_mixer.h SDL_mixer.qpg.in SDL_mixer.spec SDL_mixer.spec.in VisualC.zip Watcom-OS2.zip Xcode.tar.gz acinclude autogen.sh build-scripts configure configure.in dynamic_mp3.c dynamic_mp3.h dynamic_ogg.c dynamic_ogg.h effect_position.c effect_stereoreverse.c effects_internal.c effects_internal.h gcc-fat.sh load_aiff.c load_aiff.h load_ogg.c load_ogg.h load_voc.c load_voc.h mikmod mixer.c music.c music_cmd.c music_cmd.h music_mad.c music_mad.h music_ogg.c music_ogg.h native_midi native_midi_gpl playmus.c playwave.c timidity wavestream.c wavestream.h
DIST = CHANGES COPYING CWProjects.sea.bin MPWmake.sea.bin Makefile.in README SDL_mixer.h SDL_mixer.qpg.in SDL_mixer.spec SDL_mixer.spec.in VisualC.zip Watcom-OS2.zip Xcode.tar.gz acinclude autogen.sh build-scripts configure configure.in dynamic_mp3.c dynamic_mp3.h dynamic_ogg.c dynamic_ogg.h effect_position.c effect_stereoreverse.c effects_internal.c effects_internal.h gcc-fat.sh load_aiff.c load_aiff.h load_ogg.c load_ogg.h load_voc.c load_voc.h mikmod mixer.c music.c music_cmd.c music_cmd.h music_mad.c music_mad.h music_ogg.c music_ogg.h native_midi native_midi_gpl playmus.c playwave.c timidity wavestream.c wavestream.h version.rc

LT_AGE = @LT_AGE@
LT_CURRENT = @LT_CURRENT@
Expand Down
12 changes: 11 additions & 1 deletion build-scripts/makedep.sh
Expand Up @@ -41,7 +41,11 @@ search_deps()
for src in $SOURCES
do echo "Generating dependencies for $src"
ext=`echo $src | sed 's|.*\.\(.*\)|\1|'`
obj=`echo $src | sed "s|^.*/\([^ ]*\)\..*|\1.lo|g"`
if test x"$ext" = x"rc"; then
obj=`echo $src | sed "s|^.*/\([^ ]*\)\..*|\1.o|g"`
else
obj=`echo $src | sed "s|^.*/\([^ ]*\)\..*|\1.lo|g"`
fi
echo "\$(objects)/$obj: $src \\" >>${output}.new
search_deps $src | sort | uniq >>${output}.new
case $ext in
Expand Down Expand Up @@ -73,6 +77,12 @@ __EOF__
\$(LIBTOOL) --mode=compile \$(CC) \$(CFLAGS) \$(EXTRA_CFLAGS) -c $src -o \$@
__EOF__
;;
rc) cat >>${output}.new <<__EOF__
\$(WINDRES) $src \$@
__EOF__
;;
*) echo "Unknown file extension: $ext";;
Expand Down
221 changes: 127 additions & 94 deletions configure.in
Expand Up @@ -56,14 +56,15 @@ BUILD_CFLAGS="$CFLAGS $CPPFLAGS"
EXTRA_CFLAGS="$INCLUDE $BASE_CFLAGS"
BUILD_LDFLAGS="$LDFLAGS"
EXTRA_LDFLAGS="$BASE_LDFLAGS"
for path in /usr/local; do
if test -d $path/include; then
EXTRA_CFLAGS="$EXTRA_CFLAGS -I$path/include"
fi
if test -d $path/lib; then
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -L$path/lib"
fi
done
## These are common directories to find software packages
#for path in /usr/freeware /usr/pkg /usr/local; do
# if test -d $path/include; then
# EXTRA_CFLAGS="$EXTRA_CFLAGS -I$path/include"
# fi
# if test -d $path/lib; then
# EXTRA_LDFLAGS="$EXTRA_LDFLAGS -L$path/lib"
# fi
#done
CPPFLAGS="$CPPFLAGS $EXTRA_CFLAGS"
CFLAGS="$CFLAGS $EXTRA_CFLAGS"
LDFLAGS="$LDFLAGS $EXTRA_LDFLAGS"
Expand All @@ -72,18 +73,34 @@ dnl Check for tools
AC_LIBTOOL_WIN32_DLL
AC_PROG_LIBTOOL
AC_PROG_CC
AC_PROG_CXX
AC_PROG_INSTALL
AC_PROG_MAKE_SET
if test -z "$host_alias"; then
hostaliaswindres=
else
hostaliaswindres="$host_alias-windres"
fi
AC_CHECK_PROGS(WINDRES, [windres $hostaliaswindres $host_os-windres])

dnl Check for compiler characteristics
AC_C_CONST

case "$host" in
*-*-cygwin* | *-*-mingw32*)
SOURCES="$srcdir/version.rc"
EXE=".exe"
if test "$build" != "$host"; then # cross-compiling
# Default cross-compile location
ac_default_prefix=/usr/local/cross-tools/i386-mingw32
else
# Look for the location of the tools and install there
if test "$BUILD_PREFIX" != ""; then
ac_default_prefix=$BUILD_PREFIX
fi
fi
;;
*)
SOURCES=""
EXE=""
;;
esac
Expand All @@ -98,11 +115,24 @@ $srcdir/load_voc.c \
$srcdir/mixer.c \
$srcdir/music.c"

find_lib()
{
gcc_lib_path=[`$CC -print-search-dirs 2>/dev/null | fgrep libraries | sed 's/[^=]*=\(.*\)/\1/' | sed 's/:/ /g'`]
env_lib_path=[`echo $LIBS $LDFLAGS | sed 's/-L[ ]*//g'`]
for path in $gcc_lib_path $env_lib_path /usr/lib /usr/local/lib; do
lib=[`ls -- $path/$1 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`]
if test x$lib != x; then
echo $lib
return
fi
done
}

dnl Check for SDL
SDL_VERSION=1.2.10
AM_PATH_SDL($SDL_VERSION,
:,
AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!])
AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!])
)
EXTRA_CFLAGS="$EXTRA_CFLAGS $SDL_CFLAGS"
EXTRA_LDFLAGS="$EXTRA_LDFLAGS $SDL_LIBS"
Expand Down Expand Up @@ -132,32 +162,32 @@ 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_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`"
AC_MSG_CHECKING([for libmikmod - version >= $libmikmod_ver])
AC_TRY_RUN([
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`"
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;
}
], EXTRA_CFLAGS="$EXTRA_CFLAGS -DLIBMIKMOD_MUSIC `$LIBMIKMOD_CONFIG --cflags`";EXTRA_LDFLAGS="$EXTRA_LDFLAGS `$LIBMIKMOD_CONFIG --libs`", CFLAGS="$CFLAGS_SAVED";LIBS="$LIBS_SAVED",
[echo $ac_n "cross compiling; assumed OK... $ac_c"])
fi
fi
fi

AC_ARG_ENABLE([music-mod],
Expand Down Expand Up @@ -218,67 +248,73 @@ fi
AC_ARG_ENABLE([music-ogg],
AC_HELP_STRING([--enable-music-ogg], [enable Ogg Vorbis music [[default=yes]]]),
[], [enable_music_ogg=yes])
if test x$enable_music_ogg = xyes; then
AC_MSG_CHECKING(for Ogg Vorbis headers and libraries)
have_vorbis=no
AC_TRY_COMPILE([
#include <vorbis/vorbisfile.h>
],[
],[
have_vorbis=yes
])
AC_MSG_RESULT($have_vorbis)
if test x$have_vorbis = xyes; then
AC_ARG_ENABLE([music-ogg-shared],
AC_ARG_ENABLE(music-ogg-tremor,
[ --enable-music-ogg-tremor enable OGG 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]]]),
[], [enable_music_ogg_shared=yes])
case "$host" in
*-*-darwin*)
for path in /usr/lib /usr/local/lib; do
[], [enable_music_ogg_shared=yes])
if test x$enable_music_ogg = xyes; then
if test x$enable_music_ogg_tremor = xyes; then
AC_CHECK_HEADER([tremor/ivorbisfile.h], [have_tremor_hdr=yes])
AC_CHECK_LIB([vorbisidec], [ov_open_callbacks], [have_tremor_lib=yes])
if test x$have_tremor_hdr = xyes -a x$have_tremor_lib = xyes; then
case "$host" in
*-*-darwin*)
ogg_lib=[`find_lib libvorbisidec*.dylib`]
if test x$ogg_lib = x; then
ogg_lib=[`ls -- $path/libvorbisfile.[0-9].dylib 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`]
ogg_lib=[`find_lib libvorbisidec.[0-9]`]
fi
done
;;
*-*-cygwin* | *-*-mingw32*)
ogg_lib='vorbisfile.dll'
;;
*)
for path in /usr/lib /usr/local/lib; do
if test x$ogg_lib = x; then
ogg_lib=[`ls -- $path/libvorbisfile.so.[0-9] 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`]
ogg_lib=[`find_lib libvorbisidec.[0-9]*`]
fi
done
;;
esac
SOURCES="$SOURCES $srcdir/*_ogg.c"
EXTRA_CFLAGS="$EXTRA_CFLAGS -DOGG_MUSIC"
if test x$enable_music_ogg_shared = xyes && test x$ogg_lib != x; then
echo "-- dynamic libvorbisfile -> $ogg_lib"
EXTRA_CFLAGS="$EXTRA_CFLAGS -DOGG_DYNAMIC=\\\"$ogg_lib\\\""
else
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lvorbisfile -lvorbis -logg"
;;
*-*-cygwin* | *-*-mingw32*)
ogg_lib=[`find_lib "vorbisidec*dll"`]
;;
*)
ogg_lib=[`find_lib "libvorbisidec.so.[0-9]"`]
if test x$ogg_lib = x; then
ogg_lib=[`find_lib "libvorbisidec.so.[0-9]*"`]
fi
;;
esac
SOURCES="$SOURCES $srcdir/*_ogg.c"
EXTRA_CFLAGS="$EXTRA_CFLAGS -DOGG_MUSIC -DOGG_USE_TREMOR"
if test x$enable_music_ogg_shared = xyes && test x$ogg_lib != x; then
echo "-- dynamic libvorbisidec -> $ogg_lib"
EXTRA_CFLAGS="$EXTRA_CFLAGS -DOGG_DYNAMIC=\\\"$ogg_lib\\\""
else
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lvorbisidec"
fi
fi
else
AC_CHECK_HEADER([vorbis/vorbisfile.h], [have_ogg_hdr=yes])
AC_CHECK_LIB([vorbisfile], [ov_open_callbacks], [have_ogg_lib=yes])
if test x$have_ogg_hdr = xyes -a x$have_ogg_lib = xyes; then
case "$host" in
*-*-darwin*)
ogg_lib=[`find_lib libvorbisfile*.dylib`]
;;
*-*-cygwin* | *-*-mingw32*)
ogg_lib=[`find_lib "vorbisfile*dll"`]
;;
*)
ogg_lib=[`find_lib "libvorbisfile.so.[0-9]"`]
if test x$ogg_lib = x; then
ogg_lib=[`find_lib "libvorbisfile.so.[0-9]*"`]
fi
;;
esac
SOURCES="$SOURCES $srcdir/*_ogg.c"
EXTRA_CFLAGS="$EXTRA_CFLAGS -DOGG_MUSIC"
if test x$enable_music_ogg_shared = xyes && test x$ogg_lib != x; then
echo "-- dynamic libvorbisfile -> $ogg_lib"
EXTRA_CFLAGS="$EXTRA_CFLAGS -DOGG_DYNAMIC=\\\"$ogg_lib\\\""
else
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lvorbisfile -lvorbis -logg"
fi
fi
fi
fi
AC_ARG_ENABLE(music-ogg-tremor,
[ --enable-music-ogg-tremor enable OGG music via libtremor [[default=no]]],
, enable_music_ogg_tremor=no)
if test x$enable_music_ogg_tremor = xyes; then
AC_MSG_CHECKING(for libtremor headers)
have_tremor=no
AC_TRY_COMPILE([
#include <tremor/ivorbiscodec.h>
#include <tremor/ivorbisfile.h>
],[
],[
have_tremor=yes
])
AC_MSG_RESULT($have_tremor)
if test x$have_tremor = xyes; then
SOURCES="$SOURCES $srcdir/*_ogg.c"
EXTRA_CFLAGS="$EXTRA_CFLAGS -DOGG_MUSIC -DOGG_USE_TREMOR"
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lvorbisidec"
fi
fi
AC_ARG_ENABLE(music-mp3,
Expand All @@ -293,21 +329,16 @@ AC_HELP_STRING([--enable-music-mp3-shared], [dynamically load MP3 support [[defa
[], [enable_music_mp3_shared=yes])
case "$host" in
*-*-darwin*)
for path in /usr/lib /usr/local/lib; do
if test x$smpeg_lib = x; then
smpeg_lib=[`ls -- $path/libsmpeg*.[0-9].dylib 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`]
fi
done
smpeg_lib=[`find_lib libsmpeg*.dylib`]
;;
*-*-cygwin* | *-*-mingw32*)
smpeg_lib='smpeg.dll'
smpeg_lib=[`find_lib "smpeg*dll"`]
;;
*)
for path in /usr/lib /usr/local/lib; do
if test x$smpeg_lib = x; then
smpeg_lib=[`ls -- $path/libsmpeg*.so.[0-9] 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`]
fi
done
smpeg_lib=[`find_lib "libsmpeg.so.[0-9]"`]
if test x$smpeg_lib = x; then
smpeg_lib=[`find_lib "libsmpeg.so.[0-9]*"`]
fi
;;
esac
SOURCES="$SOURCES $srcdir/*_mp3.c"
Expand Down Expand Up @@ -341,6 +372,7 @@ if test x$enable_music_mp3_mad_gpl = xyes; then
fi

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

dnl Expand the sources and objects needed to build the library
AC_SUBST(ac_aux_dir)
Expand All @@ -351,6 +383,7 @@ AC_SUBST(EXTRA_CFLAGS)
AC_SUBST(BUILD_LDFLAGS)
AC_SUBST(EXTRA_LDFLAGS)
AC_SUBST(EXE)
AC_SUBST(WINDRES)
AC_SUBST(SDL_CFLAGS)
AC_SUBST(SDL_LIBS)

Expand Down
39 changes: 39 additions & 0 deletions version.rc
@@ -0,0 +1,39 @@
#define APSTUDIO_READONLY_SYMBOLS
#include "afxres.h"
#undef APSTUDIO_READONLY_SYMBOLS

LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US

/////////////////////////////////////////////////////////////////////////////
//
// Version
//

VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,2,8,0
PRODUCTVERSION 1,2,8,0
FILEFLAGSMASK 0x3fL
FILEFLAGS 0x0L
FILEOS 0x40004L
FILETYPE 0x2L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "CompanyName", "\0"
VALUE "FileDescription", "SDL_mixer\0"
VALUE "FileVersion", "1, 2, 8, 0\0"
VALUE "InternalName", "SDL_mixer\0"
VALUE "LegalCopyright", "Copyright � 2007 Sam Lantinga\0"
VALUE "OriginalFilename", "SDL_mixer.dll\0"
VALUE "ProductName", "Simple DirectMedia Layer\0"
VALUE "ProductVersion", "1, 2, 8, 0\0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END

0 comments on commit 4974e93

Please sign in to comment.