fix up broken with_ffmpeg check. Libraries were being linked on failure, which was very confusing, since it looked like it succeeded. Remove --with-static-ffmpeg-prefix; use --with-ffmpeg instead.

This commit is contained in:
Glenn Maynard
2007-02-20 09:38:47 +00:00
parent d699e9f8d3
commit 9428c1c852
+19 -14
View File
@@ -1,20 +1,21 @@
AC_DEFUN([SM_VIDEO], [ AC_DEFUN([SM_VIDEO], [
AC_ARG_WITH(ffmpeg, AC_HELP_STRING([--without-ffmpeg], [Disable ffmpeg support]), with_ffmpeg=$withval, with_ffmpeg=yes) AC_ARG_WITH(ffmpeg, AC_HELP_STRING([--without-ffmpeg], [Disable ffmpeg support]), with_ffmpeg=$withval, with_ffmpeg=yes)
AC_ARG_WITH(static-ffmpeg-prefix, AC_HELP_STRING([--with-static-ffmpeg-prefix=path], [Path to ffmpeg prefix]), with_static_ffmpeg_prefix=$withval, with_static_ffmpeg_prefix=)
if test "$with_ffmpeg" = "yes"; then old_LIBS="$LIBS"
if test -n "$with_static_ffmpeg_prefix"; then old_CFLAGS="$CFLAGS"
if test $(echo $with_static_ffmpeg_prefix|cut -c 1) != /; then old_CXXFLAGS="$CXXFLAGS"
with_static_ffmpeg_prefix=$(/bin/pwd)/$with_static_ffmpeg_prefix
if test "$with_ffmpeg" != "no"; then
if test "$with_ffmpeg" != "yes"; then
if test $(echo $with_ffmpeg|cut -c 1) != /; then
with_ffmpeg=$(/bin/pwd)/$with_ffmpeg
fi fi
CFLAGS="-I$with_static_ffmpeg_prefix/include $CFLAGS" CFLAGS="-I$with_ffmpeg/include $CFLAGS"
CXXFLAGS="-I$with_static_ffmpeg_prefix/include $CXXFLAGS" CXXFLAGS="-I$with_ffmpeg/include $CXXFLAGS"
old_LIBS="$LIBS" LIBS="$with_ffmpeg/lib/libavcodec.a $LIBS"
LIBS="$with_static_ffmpeg_prefix/lib/libavcodec.a $LIBS" AC_CHECK_FUNC([avcodec_init], have_libavcodec=yes, have_libavcodec=no)
AC_CHECK_FUNC([avcodec_init], have_libavcodec=yes; old_LIBS="$LIBS", have_libavcodec=no) LIBS="$with_ffmpeg/lib/libavformat.a $LIBS"
LIBS="$with_static_ffmpeg_prefix/lib/libavformat.a $LIBS" AC_CHECK_FUNC([guess_format], have_libavformat=yes, have_libavformat=no)
AC_CHECK_FUNC([guess_format], have_libavformat=yes; old_LIBS="$LIBS", have_libavformat=no)
LIBS="$old_LIBS"
else else
AC_SEARCH_LIBS(avcodec_init, [avcodec], have_libavcodec=yes, have_libavcodec=no) AC_SEARCH_LIBS(avcodec_init, [avcodec], have_libavcodec=yes, have_libavcodec=no)
AC_SEARCH_LIBS(guess_format, [avformat], have_libavformat=yes, have_libavformat=no) AC_SEARCH_LIBS(guess_format, [avformat], have_libavformat=yes, have_libavformat=no)
@@ -62,7 +63,11 @@ fi
have_ffmpeg=no have_ffmpeg=no
if test "$have_libavformat" = "yes" -a "$have_libavcodec" = "yes"; then if test "$have_libavformat" = "yes" -a "$have_libavcodec" = "yes"; then
have_ffmpeg=yes have_ffmpeg=yes
AC_DEFINE(HAVE_FFMPEG, 1, [FMPEG support available]) AC_DEFINE(HAVE_FFMPEG, 1, [FFMPEG support available])
else
LIBS="$old_LIBS"
CFLAGS="$old_CFLAGS"
CXXFLAGS="$old_CXXFLAGS"
fi fi
AM_CONDITIONAL(HAVE_FFMPEG, test "$have_ffmpeg" = "yes") AM_CONDITIONAL(HAVE_FFMPEG, test "$have_ffmpeg" = "yes")