Automatic update of common submodule
[platform/upstream/gstreamer.git] / configure.ac
index 093cab4..4f59b48 100644 (file)
@@ -3,7 +3,7 @@ AC_PREREQ(2.52)
 dnl initialize autoconf
 dnl when going to/from release please set the nano (fourth number) right !
 dnl releases only do Wall, cvs and prerelease does Werror too
-AC_INIT(GStreamer FFMpeg, 0.10.3.1,
+AC_INIT(GStreamer FFMpeg, 0.10.8.1,
     http://bugzilla.gnome.org/enter_bug.cgi?product=GStreamer,
     gst-ffmpeg)
 
@@ -40,7 +40,7 @@ AC_LIBTOOL_WIN32_DLL
 AM_PROG_LIBTOOL
 
 dnl *** required versions of GStreamer stuff ***
-GST_REQ=0.10.13
+GST_REQ=0.10.22
 LIBOIL_MAJORMINOR=0.3
 LIBOIL_REQ=0.3.6
 
@@ -199,6 +199,13 @@ case $host_os in
 esac
 AC_SUBST(DARWIN_LDFLAGS)
 
+dnl *** Check for bz2
+AG_GST_CHECK_LIBHEADER(BZ2, bz2, BZ2_bzlibVersion, , bzlib.h, have_bz2=yes, have_bz2=no)
+AM_CONDITIONAL(HAVE_BZ2, test "x$have_bz2" = "xyes")
+if test "x$have_bz2" = "xno"; then
+  AC_WARN([libbz2 not found, matroska demuxer will not be able to read bz2 tracks])
+fi
+
 dnl *** configure external libs ***
 
 HAVE_FFMPEG_UNINSTALLED=1
@@ -207,8 +214,9 @@ AC_ARG_WITH(system-ffmpeg,
             [AC_HELP_STRING([--with-system-ffmpeg], [use system FFmpeg libraries])])
 
 if test "x$with_system_ffmpeg" = "xyes"; then
-  PKG_CHECK_MODULES(FFMPEG, libavutil libavcodec libavformat)
-  PKG_CHECK_MODULES(POSTPROC, libavcodec libpostproc)
+  PKG_CHECK_MODULES(FFMPEG, libavformat libavcodec libavutil) 
+  PKG_CHECK_MODULES(POSTPROC, libpostproc libavcodec libavutil)
+  PKG_CHECK_MODULES(SWSCALE, libswscale libavutil)
   saved_CPPFLAGS="$CPPFLAGS"
   CPPFLAGS="$CPPFLAGS $FFMPEG_CFLAGS"
   AC_CHECK_HEADERS([avi.h])
@@ -249,7 +257,7 @@ if test "x$with_system_ffmpeg" = "xyes"; then
   sleep 15
 else
 
-  source ./ffmpegrev
+  source "$srcdir/ffmpegrev"
   
   AC_MSG_NOTICE([Using ffmpeg revision $FFMPEG_REVISION])
   
@@ -275,26 +283,94 @@ else
   POSTPROC_LIBS="\$(top_builddir)/gst-libs/ext/ffmpeg/libpostproc/libpostproc.a \
                 \$(top_builddir)/gst-libs/ext/ffmpeg/libavutil/libavutil.a"
                                 
+  dnl
+  SWSCALE_CFLAGS="-I \$(top_srcdir)/gst-libs/ext/ffmpeg/libswscale     \
+                  -I \$(top_srcdir)/gst-libs/ext/ffmpeg/libavutil      \
+                  -I \$(top_srcdir)/gst-libs/ext/ffmpeg        \
+                  -Wno-deprecated-declarations"
+
+  dnl libgstswscale.la: libs to statically link to
+  SWSCALE_LIBS="\$(top_builddir)/gst-libs/ext/ffmpeg/libswscale/libswscale.a \
+                \$(top_builddir)/gst-libs/ext/ffmpeg/libavutil/libavutil.a"
+
   FFMPEG_SUBDIRS=gst-libs
   AC_DEFINE(HAVE_AVI_H)
   AC_DEFINE([FFMPEG_SOURCE], ["local snapshot"], [Describes where the FFmpeg libraries come from.])
+
+  AC_ARG_WITH(ffmpeg-extra-configure, 
+      AC_HELP_STRING([--with-ffmpeg-extra-configure="xxx"],
+      [extra configure options for internal ffmpeg ./configure script]),,
+      with_ffmpeg_extra_configure=no)
+
+  # basic arguments
+  embffmpeg_configure_args="--prefix=$prefix"
+
   # Enable shared and static so that we get .a files, but with PIC code.
-  ac_configure_args="$ac_configure_args --disable-vhook --disable-ffserver --disable-ffplay --enable-postproc --enable-gpl --enable-static --enable-shared --disable-encoder=flac --disable-decoder=cavs"
+  embffmpeg_configure_args="$embffmpeg_configure_args --disable-ffserver --disable-ffplay --enable-postproc --enable-gpl --enable-static --enable-shared --disable-encoder=flac --disable-decoder=cavs --disable-protocols --disable-devices --disable-network --disable-vhook"
+
+  # if we are cross-compiling, tell ffmpeg so
+  if test "x$cross_compiling" = xyes; then
+    embffmpeg_configure_args="$embffmpeg_configure_args --enable-cross-compile \
+        --target-os=$host_os --arch=$host_cpu --cross-prefix=$host_alias-"
+  fi
+
   case $host_os in
     # Unfortunately, in Mac OS 10.5 the current rev of ffmpeg builds
     # some non-PIC code into the .a file. See
     # http://trac.macosforge.org/projects/macports/ticket/13725 for more
     # info.
     darwin*) 
-      ac_configure_args="$ac_configure_args --disable-mmx --disable-altivec"
+      embffmpeg_configure_args="$embffmpeg_configure_args --disable-mmx --disable-altivec"
+      ;;
+    mingw32*)
+      embffmpeg_configure_args="$embffmpeg_configure_args --enable-memalign-hack"
+      WIN32_LIBS="-lws2_32"
       ;;
     *)
+      WIN32_LIBS=
       ;;
   esac
+
+  dnl checks for extra enable/disable flags
+  FFMPEG_OPTS="`$srcdir/gst-libs/ext/ffmpeg/configure --help`"
+  # Let's check if we can disable the building of the ffmpeg binary
+  can_disable=`echo "$FFMPEG_OPTS" | grep 'disable-ffmpeg' | wc -l`
+  if test "$can_disable" != "0"; then
+    embffmpeg_configure_args="$embffmpeg_configure_args --disable-ffmpeg"
+  fi
+  dnl check if libswscale needs enabling explicitly
+  can_enable=`echo "$FFMPEG_OPTS" | grep 'enable-swscale' | wc -l`
+  if test "$can_enable" != "0"; then
+    embffmpeg_configure_args="$embffmpeg_configure_args --enable-swscale"
+  fi
+
+  # append extra configure options to embffmpeg_configure_args if needed
+  if test "x$with_ffmpeg_extra_configure" != "xno"; then
+    embffmpeg_configure_args="$embffmpeg_configure_args $with_ffmpeg_extra_configure"
+  fi
+
   AC_SUBST(FFMPEG_CO_DIR)
   AC_SUBST(FFMPEG_SVN)
   AC_SUBST(FFMPEG_REVISION)
-  AC_CONFIG_SUBDIRS(gst-libs/ext/ffmpeg)
+  AC_SUBST(FFMPEG_EXTERNALS_REVISION)
+  AC_CONFIG_COMMANDS([configure-embedded-ffmpeg],
+    [echo "Configuring included FFmpeg instance with args $embffmpeg_configure_args"
+     origdir=`pwd`
+     dnl Don't put path on the configure call when not needed, as FFmpeg's configure relies on it
+     dnl to detect out-of-tree builds
+     if test -z "$srcdir" -o "$srcdir" = .; then
+       confcmd=./configure
+     else
+       confcmd="$origdir"/"$ac_top_srcdir"/gst-libs/ext/ffmpeg/configure
+     fi
+
+     AS_MKDIR_P(["$ac_top_build_prefix"gst-libs/ext/ffmpeg])
+     cd "$ac_top_build_prefix"gst-libs/ext/ffmpeg &&
+         $confcmd $embffmpeg_configure_args ||
+         AC_MSG_ERROR([Failed to configure embedded FFmpeg tree])
+     cd "$origdir"
+    ],
+    [embffmpeg_configure_args="$embffmpeg_configure_args"])
   AC_MSG_NOTICE([Using included FFMpeg code])
 fi
 
@@ -303,24 +379,32 @@ AC_SUBST(FFMPEG_LIBS)
 AC_SUBST(FFMPEG_SUBDIRS)
 AC_SUBST(POSTPROC_CFLAGS)
 AC_SUBST(POSTPROC_LIBS)
-  
-AC_DEFINE_UNQUOTED(HAVE_FFMPEG_UNINSTALLED, $HAVE_FFMPEG_UNINSTALLED,
-                   [Defined if building against uninstalled FFmpeg source])
+AC_SUBST(SWSCALE_CFLAGS)
+AC_SUBST(SWSCALE_LIBS)
+AC_SUBST(WIN32_LIBS)
+if test x$HAVE_FFMPEG_UNINSTALLED = x1; then
+  AC_DEFINE(HAVE_FFMPEG_UNINSTALLED, [], [Defined if building against uninstalled FFmpeg source])
+fi
 AM_CONDITIONAL(HAVE_FFMPEG_UNINSTALLED, test x$HAVE_FFMPEG_UNINSTALLED = x1)
 
+SHAVE_INIT([common],[enable])
+
 AC_CONFIG_FILES(
 Makefile
+common/Makefile
+common/m4/Makefile
+common/shave
+common/shave-libtool
 gst-ffmpeg.spec
 ext/Makefile
 ext/ffmpeg/Makefile
 ext/libpostproc/Makefile
+ext/libswscale/Makefile
 gst-libs/Makefile
 gst-libs/ext/Makefile
 docs/Makefile
 docs/version.entities
-docs/plugins/Makefile
-common/Makefile
-common/m4/Makefile
 tests/Makefile
 tests/check/Makefile
 )