Cope with some changes in the locations of the libavformat and libswscale headers.
[synfig.git] / synfig-core / trunk / configure.ac
index 6627b39..882f16d 100644 (file)
@@ -246,6 +246,51 @@ if test $with_libavcodec = "yes" ; then {
 } ; fi
 
 
+if test $with_libavcodec = "yes" ; then {
+
+       # Need to check both the new and old locations for the avformat header
+       # Need to save flags, add avformat flags, check headers and restore flags
+       ac_save_CPPFLAGS="$CPPFLAGS"
+       ac_save_CFLAGS="$CFLAGS"
+       CPPFLAGS="${CPPFLAGS} ${LIBAVCODEC_CFLAGS}"
+       CFLAGS="${CFLAGS} ${LIBAVCODEC_CFLAGS}"
+       AC_CHECK_HEADERS(libavformat/avformat.h avformat.h ffmpeg/avformat.h)
+       CPPFLAGS="${ac_save_CPPFLAGS}"
+       CFLAGS="${ac_save_CFLAGS}"
+
+       AC_ARG_WITH(libswscale,
+               [AS_HELP_STRING([--without-libswscale],
+                       [disable support for libswscale (Default=auto)])],
+               [],
+               [with_libswscale="yes"]
+       )
+
+       if test $with_libswscale != "no" ; then {
+               PKG_CHECK_MODULES(LIBSWSCALE, [libswscale], [], [echo no; with_libswscale="no"])
+       } ; fi
+
+       if test $with_libswscale = "yes" ; then {
+               AC_DEFINE(WITH_LIBSWSCALE, [], [enable libswscale support])
+
+               # Need to check both the new and old locations for the swscale header
+               # Need to save flags, add swscale flags, check headers and restore flags
+               ac_save_CPPFLAGS="$CPPFLAGS"
+               ac_save_CFLAGS="$CFLAGS"
+               CPPFLAGS="${CPPFLAGS} ${LIBSWSCALE_CFLAGS}"
+               CFLAGS="${CFLAGS} ${LIBSWSCALE_CFLAGS}"
+               AC_CHECK_HEADERS(libswscale/swscale.h swscale.h ffmpeg/swscale.h)
+               CPPFLAGS="${ac_save_CPPFLAGS}"
+               CFLAGS="${ac_save_CFLAGS}"
+       } else {
+               AC_CHECK_LIB(avcodec, img_convert,
+                       [AC_MSG_RESULT([ *** Using deprecated function img_convert.])],
+                       [AC_MSG_FAILURE([Neither libswscale nor function img_convert was found.])],
+                       []
+               )
+       } ; fi
+} ; fi
+AM_CONDITIONAL(WITH_LIBSWSCALE, test "x$with_libswscale" = "xyes")
+
 
 # FREETYPE2 CHECK--------------------
 
@@ -403,7 +448,7 @@ AC_CHECK_LIB(mng, mng_initialize,[
        AM_CONDITIONAL(HAVE_LIBMNG,false)
 ],[-lz -L${exec_prefix}/lib])
 
-AC_CHECK_LIB(jpeg, main,[
+AC_CHECK_LIB(jpeg, jpeg_CreateCompress,[
        JPEG_LIBS="-ljpeg"
        AC_DEFINE(HAVE_LIBJPEG,[], [ Define if JPEG library is available ] )
        AC_SUBST(JPEG_LIBS)
@@ -620,9 +665,9 @@ examples/walk/Makefile
 examples/Makefile
 win32inst.nsi
 pkg-info/macosx/synfig-core.info
-dnl src/modules/trgt_mpg/Makefile
-dnl src/modules/mptr_mplayer/Makefile
 ])
+## src/modules/trgt_mpg/Makefile
+## src/modules/mptr_mplayer/Makefile
 AC_OUTPUT
 
 # -- S U M M A R Y --------------------------------------------
@@ -647,6 +692,7 @@ ETL_CFLAGS -----------------------> $ETL_CFLAGS
 FreeType2 ------------------------> $with_freetype
 fontconfig -----------------------> $with_fontconfig
 libavcodec -----------------------> $with_libavcodec
+libswscale -----------------------> $with_libswscale
 vImage ---------------------------> $with_vimage
 ImageMagick ----------------------> $with_imagemagick
 Magick++ -------------------------> $with_magickpp