Skip to content

Commit

Permalink
Fixed bug 2743 - building against libmad is broken (with fix)
Browse files Browse the repository at this point in the history
Ozkan Sezer

Configuring current hg with --disable-music-mp3-smpeg --enable-music-mp3-mad-gpl
fails compilation:

mixer.c: In function ???Mix_LoadWAV_RW???:
mixer.c:655: warning: assignment makes pointer from integer without a cast
build/.libs/libSDL2_mixer.so: undefined reference to `Mix_LoadMP3_RW'
collect2: ld returned 1 exit status
build/.libs/libSDL2_mixer.so: undefined reference to `Mix_LoadMP3_RW'

The attached simple patch fixes this.
  • Loading branch information
slouken committed Aug 2, 2015
1 parent c02a7dc commit 853b25e
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 9 deletions.
13 changes: 9 additions & 4 deletions configure
Expand Up @@ -11065,7 +11065,7 @@ case "$host" in
*mingw32ce*)
#VERSION_SOURCES="$srcdir/version.rc"
EXE=".exe"
;;
;;
*-*-cygwin* | *-*-mingw32*)
VERSION_SOURCES="$srcdir/version.rc"
EXE=".exe"
Expand Down Expand Up @@ -11954,7 +11954,7 @@ fi
echo "-- dynamic libmodplug -> $modplug_lib"
EXTRA_CFLAGS="$EXTRA_CFLAGS -DMODPLUG_DYNAMIC=\\\"$modplug_lib\\\""
else
EXTRA_LDFLAGS="$EXTRA_LDFLAGS $MODPLUG_LIBS"
EXTRA_LDFLAGS="$EXTRA_LDFLAGS $MODPLUG_LIBS"
fi
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: *** Unable to find ModPlug library (http://modplug-xmms.sourceforge.net/)" >&5
Expand Down Expand Up @@ -12095,7 +12095,7 @@ $as_echo "$as_me: WARNING: *** Unable to find MikMod library (http://mikmod.raph
fi

if test x$have_libmodplug != xyes -a x$have_libmikmod != xyes ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: MOD support disabled" >&5
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: MOD support disabled" >&5
$as_echo "$as_me: WARNING: MOD support disabled" >&2;}
fi

Expand Down Expand Up @@ -12251,7 +12251,7 @@ fi
if test x$enable_music_midi_timidity != xyes -a \
x$use_music_midi_native != xyes -a x$use_music_midi_native != xyes_cpp -a \
x$have_fluidsynth != xyes; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: MIDI support disabled" >&5
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: MIDI support disabled" >&5
$as_echo "$as_me: WARNING: MIDI support disabled" >&2;}
fi

Expand Down Expand Up @@ -12897,6 +12897,11 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
$as_echo "$have_libmad" >&6; }
if test x$have_libmad = xyes; then
SOURCES="$SOURCES $srcdir/music_mad.c"
if echo "$SOURCES" | grep "load_mp3.c" >/dev/null; then
:
else
SOURCES="$SOURCES $srcdir/load_mp3.c"
fi
EXTRA_CFLAGS="$EXTRA_CFLAGS -DMP3_MAD_MUSIC"
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lmad"
else
Expand Down
13 changes: 9 additions & 4 deletions configure.in
Expand Up @@ -115,7 +115,7 @@ case "$host" in
*mingw32ce*)
#VERSION_SOURCES="$srcdir/version.rc"
EXE=".exe"
;;
;;
*-*-cygwin* | *-*-mingw32*)
VERSION_SOURCES="$srcdir/version.rc"
EXE=".exe"
Expand Down Expand Up @@ -283,7 +283,7 @@ if test x$enable_music_mod = xyes -a x$enable_music_mod_modplug = xyes; then
echo "-- dynamic libmodplug -> $modplug_lib"
EXTRA_CFLAGS="$EXTRA_CFLAGS -DMODPLUG_DYNAMIC=\\\"$modplug_lib\\\""
else
EXTRA_LDFLAGS="$EXTRA_LDFLAGS $MODPLUG_LIBS"
EXTRA_LDFLAGS="$EXTRA_LDFLAGS $MODPLUG_LIBS"
fi
else
AC_MSG_WARN([*** Unable to find ModPlug library (http://modplug-xmms.sourceforge.net/)])
Expand Down Expand Up @@ -359,7 +359,7 @@ return 1;
fi

if test x$have_libmodplug != xyes -a x$have_libmikmod != xyes ; then
AC_MSG_WARN([MOD support disabled])
AC_MSG_WARN([MOD support disabled])
fi

AC_ARG_ENABLE([music-midi],
Expand Down Expand Up @@ -448,7 +448,7 @@ fi
if test x$enable_music_midi_timidity != xyes -a \
x$use_music_midi_native != xyes -a x$use_music_midi_native != xyes_cpp -a \
x$have_fluidsynth != xyes; then
AC_MSG_WARN([MIDI support disabled])
AC_MSG_WARN([MIDI support disabled])
fi

AC_ARG_ENABLE([music-ogg],
Expand Down Expand Up @@ -637,6 +637,11 @@ if test x$enable_music_mp3 = xyes -a x$enable_music_mp3_mad_gpl = xyes; then
AC_MSG_RESULT($have_libmad)
if test x$have_libmad = xyes; then
SOURCES="$SOURCES $srcdir/music_mad.c"
if echo "$SOURCES" | grep "load_mp3.c" >/dev/null; then
:
else
SOURCES="$SOURCES $srcdir/load_mp3.c"
fi
EXTRA_CFLAGS="$EXTRA_CFLAGS -DMP3_MAD_MUSIC"
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lmad"
else
Expand Down
2 changes: 1 addition & 1 deletion load_mp3.h
Expand Up @@ -23,7 +23,7 @@

/* $Id$ */

#ifdef MP3_MUSIC
#if defined(MP3_MUSIC) || defined(MP3_MAD_MUSIC)
/* Don't call this directly; use Mix_LoadWAV_RW() for now. */
SDL_AudioSpec *Mix_LoadMP3_RW (SDL_RWops *src, int freesrc,
SDL_AudioSpec *spec, Uint8 **audio_buf, Uint32 *audio_len);
Expand Down
2 changes: 2 additions & 0 deletions mixer.c
Expand Up @@ -192,6 +192,8 @@ int Mix_Init(int flags)
if ((initialized & MIX_INIT_MP3) || Mix_InitMP3() == 0) {
result |= MIX_INIT_MP3;
}
#elif defined(MP3_MAD_MUSIC)
result |= MIX_INIT_MP3;
#else
Mix_SetError("Mixer not built with MP3 support");
#endif
Expand Down

0 comments on commit 853b25e

Please sign in to comment.