Fixed bug 3907 - make sure libmpg123 is recent enough
authorSam Lantinga <slouken@libsdl.org>
Sun, 22 Oct 2017 10:48:52 -0700
changeset 829ab82b7aff1fd
parent 828 561ae6f09324
child 830 c292b484a95e
Fixed bug 3907 - make sure libmpg123 is recent enough

Ozkan Sezer

The attached patch makes sure that we are building against
a recent-enough libmpg123: mpg123_replace_reader_handle()
requires MPG123_API_VERSION >= 24.

diff --git a/music_mpg123.c b/music_mpg123.c
--- a/music_mpg123.c
+++ b/music_mpg123.c
@@ -32,6 +32,11 @@

#include <mpg123.h>

+/* MPG123_API_VERSION >= 24 needed for mpg123_replace_reader_handle() */
+#if !defined(MPG123_API_VERSION) || (MPG123_API_VERSION-0 < 24)
+#error minimum required libmpg123 version is 1.12.0 (api version 24)
+#endif
+

typedef struct {
int loaded;
configure
configure.in
     1.1 --- a/configure	Sat Oct 21 22:28:18 2017 -0700
     1.2 +++ b/configure	Sun Oct 22 10:48:52 2017 -0700
     1.3 @@ -12922,9 +12922,9 @@
     1.4  fi
     1.5  
     1.6  
     1.7 -    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for mpg123_init in -lmpg123" >&5
     1.8 -$as_echo_n "checking for mpg123_init in -lmpg123... " >&6; }
     1.9 -if ${ac_cv_lib_mpg123_mpg123_init+:} false; then :
    1.10 +    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for mpg123_replace_reader_handle in -lmpg123" >&5
    1.11 +$as_echo_n "checking for mpg123_replace_reader_handle in -lmpg123... " >&6; }
    1.12 +if ${ac_cv_lib_mpg123_mpg123_replace_reader_handle+:} false; then :
    1.13    $as_echo_n "(cached) " >&6
    1.14  else
    1.15    ac_check_lib_save_LIBS=$LIBS
    1.16 @@ -12938,27 +12938,27 @@
    1.17  #ifdef __cplusplus
    1.18  extern "C"
    1.19  #endif
    1.20 -char mpg123_init ();
    1.21 +char mpg123_replace_reader_handle ();
    1.22  int
    1.23  main ()
    1.24  {
    1.25 -return mpg123_init ();
    1.26 +return mpg123_replace_reader_handle ();
    1.27    ;
    1.28    return 0;
    1.29  }
    1.30  _ACEOF
    1.31  if ac_fn_c_try_link "$LINENO"; then :
    1.32 -  ac_cv_lib_mpg123_mpg123_init=yes
    1.33 -else
    1.34 -  ac_cv_lib_mpg123_mpg123_init=no
    1.35 +  ac_cv_lib_mpg123_mpg123_replace_reader_handle=yes
    1.36 +else
    1.37 +  ac_cv_lib_mpg123_mpg123_replace_reader_handle=no
    1.38  fi
    1.39  rm -f core conftest.err conftest.$ac_objext \
    1.40      conftest$ac_exeext conftest.$ac_ext
    1.41  LIBS=$ac_check_lib_save_LIBS
    1.42  fi
    1.43 -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_mpg123_mpg123_init" >&5
    1.44 -$as_echo "$ac_cv_lib_mpg123_mpg123_init" >&6; }
    1.45 -if test "x$ac_cv_lib_mpg123_mpg123_init" = xyes; then :
    1.46 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_mpg123_mpg123_replace_reader_handle" >&5
    1.47 +$as_echo "$ac_cv_lib_mpg123_mpg123_replace_reader_handle" >&6; }
    1.48 +if test "x$ac_cv_lib_mpg123_mpg123_replace_reader_handle" = xyes; then :
    1.49    have_mpg123_lib=yes
    1.50  fi
    1.51  
     2.1 --- a/configure.in	Sat Oct 21 22:28:18 2017 -0700
     2.2 +++ b/configure.in	Sun Oct 22 10:48:52 2017 -0700
     2.3 @@ -641,7 +641,7 @@
     2.4                [], [enable_music_mp3_mpg123_shared=yes])
     2.5  if test x$enable_music_mp3_mpg123 = xyes; then
     2.6      AC_CHECK_HEADER([mpg123.h], [have_mpg123_hdr=yes])
     2.7 -    AC_CHECK_LIB([mpg123], [mpg123_init], [have_mpg123_lib=yes])
     2.8 +    AC_CHECK_LIB([mpg123], [mpg123_replace_reader_handle], [have_mpg123_lib=yes])
     2.9      if test x$have_mpg123_hdr = xyes -a x$have_mpg123_lib = xyes; then
    2.10          have_mpg123=yes
    2.11          case "$host" in