From: Daniel Drake Add ffmpeg configure flag, support both old and new ffmpeg versions correctly Index: coriander/configure.in =================================================================== --- coriander.orig/configure.in +++ coriander/configure.in @@ -313,42 +315,51 @@ AC_DEFUN([AC_CHECK_LFS],[ ]) AC_DEFUN([AC_CHECK_FFMPEG],[ + PKG_CHECK_MODULES(FFMPEG, libavformat libavcodec, + have_ffmpeg=yes, have_ffmpeg=no) AC_SUBST(FFMPEG_CFLAGS) AC_SUBST(FFMPEG_LIBS) - AC_CHECK_PROG(have_pkg_config, pkg-config --libs libavformat libavcodec, "found", "no") - if test x$have_pkg_config = xfound; then - AC_MSG_CHECKING(ffmpeg version) - AC_TRY_COMPILE([ - #include - ],[ - int main(void) { - AVFormatContext *oc; - AVCodecContext *c; - AVStream *st; - st = av_new_stream(oc, 0); - c = st->codec; - return 0; - } - ],ffmpeg=ok,ffmpeg=no); - AC_MSG_RESULT($ffmpeg) - if test x$ffmpeg = xok; then - FFMPEG_LIBS=`pkg-config --libs libavformat libavcodec` - FFMPEG_CFLAGS=`pkg-config --cflags libavformat libavcodec` - AC_DEFINE(HAVE_FFMPEG,1,[defined if ffmpeg is available]) - else - AC_MSG_RESULT([ffmpeg required for MPEG video saving. + + # Older ffmpeg releases have ffmpeg-config rather than installing .pc files + if test x$have_ffmpeg = xno; then + AC_CHECK_PROG(have_ffmpeg, ffmpeg-config, "yes", "no") + if test x$have_ffmpeg = xyes; then + FFMPEG_LIBS=`ffmpeg-config --libs avformat avcodec` + FFMPEG_CFLAGS=`ffmpeg-config --cflags` + fi + fi + + if test x$have_ffmpeg = xyes; then + AC_MSG_CHECKING(ffmpeg version) + AC_TRY_COMPILE([#include ],[ + int main(void) { + AVFormatContext *oc; + AVCodecContext *c; + AVStream *st; + st = av_new_stream(oc, 0); + c = st->codec; + return 0; + } + ],ffmpeg=ok,ffmpeg=outdated); + AC_MSG_RESULT($ffmpeg) + if test x$ffmpeg = xok; then + AC_DEFINE(HAVE_FFMPEG,1,[defined if ffmpeg is available]) + else + if test "x$want_ffmpeg" = "xyes"; then + AC_ERROR([ffmpeg is too old. ************************************************************************** -** ffmpeg can be obtained using your favorite package mamagement ** -** system (such as apt-get). Be sure to get ffmpeg and the two ** -** development packages libavcodec-dev and libavformat-dev (on ** -** Debian). You need version 0.4.9 or later. ** -** Saving JPEG images and MPEG movies is DISABLED. ** +** Please install ffmpeg version 0.4.9 minimum ** **************************************************************************]) - fi + fi + fi else - AC_MSG_RESULT([pkg_config not found. + AC_MSG_RESULT([ffmpeg required for MPEG video saving. ************************************************************************** -** This prevents the detection of FFMPEG. ** +** ffmpeg can be obtained using your favorite package mamagement ** +** system (such as apt-get). Be sure to get ffmpeg and the two ** +** development packages libavcodec-dev and libavformat-dev (on ** +** Debian). In the end, you should have the executable 'ffmpeg-config'** +** somewhere on your system. ** ** Saving JPEG images and MPEG movies is DISABLED. ** **************************************************************************]) fi @@ -369,7 +380,14 @@ AC_CHECK_LIBRAW AC_CHECK_LIBDC AC_CHECK_FTPLIB AC_CHECK_SDLLIB -AC_CHECK_FFMPEG + +AC_ARG_ENABLE(ffmpeg, + AS_HELP_STRING(--enable-ffmpeg, [enable MPEG video saving (default auto)]), + want_ffmpeg=$enableval, want_ffmpeg=auto) + +if test "x$want_ffmpeg" != "xno"; then + AC_CHECK_FFMPEG +fi dnl deprecated: dnl AC_CHECK_GDK_PIXBUF