From 6c7b619c838b01f23f0964c5996d95d7b4ac45bc Mon Sep 17 00:00:00 2001 From: Amar Takhar Date: Sun, 9 Mar 2008 07:38:49 +0000 Subject: [PATCH] Add a configure-time check using avcodec_find_encoder_by_name("libmp3lame") to look for LAME support. Unfortunatly FFMPEG's internal MP3 support is rather broken. If --enable-broken-mp3 is supplied configure will continue otherwise LAME must be compiled into FFMPEG. Originally committed to SVN as r1989. --- configure.in | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/configure.in b/configure.in index c88cb088e..8d5bc666f 100644 --- a/configure.in +++ b/configure.in @@ -225,6 +225,49 @@ if test "$with_ffmpeg" != "no"; then fi fi + +if test "$with_ffmpeg" = "yes"; then + +AC_ARG_ENABLE(broken-mp3, [--enable-broken-mp3 Enable the use of FFMPEG w/out LAME compiled in.]) + AC_MSG_CHECKING([whether ffmpeg has LAME compiled in]) + aegisub_save_LDFLAGS="$LDFLAGS" + AC_LANG(C) + LDFLAGS="$LDFLAGS $AVCODEC_LDFLAGS" + AC_RUN_IFELSE( + [AC_LANG_PROGRAM([#include ], + [ + avcodec_register_all(); + if (avcodec_find_encoder_by_name("libmp3lame")) + return 1; + ]) + ], + ffmpeg_mp3_broken="yes", + ffmpeg_mp3_broken="no") + + LDFLAGS="$aegisub_save_LDFLAGS" + AC_LANG(C++) +fi + +if test $ffmpeg_mp3_broken = "yes"; then + AC_MSG_RESULT([no]) + AC_MSG_NOTICE([ +*********************************************************************** +* Your installation of FFMPEG does not have LAME support compiled in. +* This will result in _broken_ mp3 decoding, either recompile FFMPEG +* with LAME support, or supply --with-broken-mp3 (With this you will have +* to demux the audio, convert to wav and load the audio/wav seperately.) +* * LAME can be found at: http://lame.sourceforge.net/index.php +*********************************************************************** + ]) +echo "enable_broken_mp3: $enable_broken_mp3" + if test "$enable_broken_mp3" != "yes"; then + AC_MSG_FAILURE([Please read.]) + fi +else + AC_MSG_RESULT([yes]) +fi + + AC_SUBST(SWSCALE_LDFLAGS) AC_SUBST(AVCODEC_LDFLAGS) AC_SUBST(AVFORMAT_LDFLAGS)