From b706c481d32438a637fb448fda8de20be3d1b3fa Mon Sep 17 00:00:00 2001 From: Damien Lespiau Date: Wed, 8 Oct 2008 11:24:26 +0000 Subject: [PATCH] Fix cross compilation and add support for compilation with mingw32. Original commit message from CVS: Patch by: Damien Lespiau * configure.ac: * ext/ffmpeg/Makefile.am: Fix cross compilation and add support for compilation with mingw32. Fixes bug #542216. --- ChangeLog | 9 +++++++++ common | 2 +- configure.ac | 25 +++++++++++++++++++++++++ ext/ffmpeg/Makefile.am | 2 +- 4 files changed, 36 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8f1242ee41..58a1b7c233 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2008-10-08 Sebastian Dröge + + Patch by: Damien Lespiau + + * configure.ac: + * ext/ffmpeg/Makefile.am: + Fix cross compilation and add support for compilation with mingw32. + Fixes bug #542216. + 2008-09-06 Stefan Kost * configure.ac: diff --git a/common b/common index 1ff63d8f92..46eefd2f84 160000 --- a/common +++ b/common @@ -1 +1 @@ -Subproject commit 1ff63d8f92c36bf207434436f4ce75f2a4ea11a4 +Subproject commit 46eefd2f8474ee748864c59635be87b5a29317d1 diff --git a/configure.ac b/configure.ac index a267e18782..db9ba321e9 100644 --- a/configure.ac +++ b/configure.ac @@ -281,8 +281,21 @@ else 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) + # 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 --disable-protocols --disable-devices --disable-network" + + # if we are cross-compiling, tell ffmpeg so + if test "x$cross_compiling" = xyes; then + ac_configure_args="$ac_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 @@ -291,9 +304,20 @@ else darwin*) ac_configure_args="$ac_configure_args --disable-mmx --disable-altivec" ;; + mingw32*) + ac_configure_args="$ac_configure_args --enable-memalign-hack" + WIN32_LIBS="-lws2_32" + ;; *) + WIN32_LIBS= ;; esac + + # append extra configure options to ac_configure_args if needed + if test "x$with_ffmpeg_extra_configure" != no; then + ac_configure_args="$ac_configure_args $with_ffmpeg_extra_configure" + fi + AC_SUBST(FFMPEG_CO_DIR) AC_SUBST(FFMPEG_SVN) AC_SUBST(FFMPEG_REVISION) @@ -306,6 +330,7 @@ AC_SUBST(FFMPEG_LIBS) AC_SUBST(FFMPEG_SUBDIRS) AC_SUBST(POSTPROC_CFLAGS) AC_SUBST(POSTPROC_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]) diff --git a/ext/ffmpeg/Makefile.am b/ext/ffmpeg/Makefile.am index c76eeb882f..6a2e96900c 100644 --- a/ext/ffmpeg/Makefile.am +++ b/ext/ffmpeg/Makefile.am @@ -15,7 +15,7 @@ libgstffmpeg_la_SOURCES = gstffmpeg.c \ libgstffmpeg_la_CFLAGS = $(GST_CFLAGS) $(GST_PLUGINS_BASE_CFLAGS) \ $(FFMPEG_CFLAGS) -libgstffmpeg_la_LIBADD = $(FFMPEG_LIBS) $(GST_BASE_LIBS) $(LIBM) -lz -lbz2 +libgstffmpeg_la_LIBADD = $(FFMPEG_LIBS) $(GST_BASE_LIBS) $(LIBM) $(WIN32_LIBS) -lz -lbz2 libgstffmpeg_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) $(DARWIN_LDFLAGS) if HAVE_FFMPEG_UNINSTALLED