]> git.sesse.net Git - mlt/commitdiff
add configure options and fixes for cross-compiling
authorDan Dennedy <dan@dennedy.org>
Sat, 26 May 2012 23:14:19 +0000 (23:14 +0000)
committerDan Dennedy <dan@dennedy.org>
Sat, 26 May 2012 23:14:19 +0000 (23:14 +0000)
configure
src/mlt++/configure
src/modules/qimage/configure
src/modules/swfdec/Makefile
src/modules/videostab/stab/estimate.c

index 89307f346b9c671a8e39d714786f79d5b97c69a9..8ae178f0717c8d92627004441b0918c25bfa3586 100755 (executable)
--- a/configure
+++ b/configure
@@ -27,6 +27,8 @@ General build options:
   --disable-sse2          - Compile without SSE2 support (default: on)
   --arch='arch'           - Compile for a specific architecture (default: none)
   --cpu='cpu'             - Compile for a specific CPU (default: none)
+  --target-os='os'        - Cross-compile to a specific OS (default: $(uname -s))
+  --target-arch='arch'    - Cross-compile to a specific CPU architecture
 
 Module disable options:
 
@@ -69,6 +71,7 @@ build_config()
 
                echo "LARGE_FILE=-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE"
 
+               [ "$amd64" = "true" ] && echo "ARCH_X86_64=1" && echo "CFLAGS+=-DARCH_X86_64"
                [ "$arch" != "" ] && echo "TARGETARCH=-march=$arch"
                [ "$cpu" != "" ] && echo "TARGETCPU=-mcpu=$cpu"
                if [ "$optimisations" = "true" ]
@@ -84,13 +87,11 @@ build_config()
 
                case $targetos in
                Darwin)
-               sysctl -a hw | grep "x86_64: 1" > /dev/null && echo "ARCH_X86_64=1" && echo "CFLAGS+=-DARCH_X86_64"
                echo "CFLAGS+=-fPIC -D__DARWIN__ `sdl-config --cflags`"
                echo "SHFLAGS=-dynamiclib"
                echo "LDFLAGS+=`sdl-config --libs`"
                ;;
                Linux|GNU/kFreeBSD|GNU)
-               [ "$(uname -m)" = "x86_64" ] && echo "ARCH_X86_64=1" && echo "CFLAGS+=-DARCH_X86_64"
                [ "$optimisations" = "true" ] &&
                        echo "OPTIMISATIONS+=-ffast-math"
                echo "CFLAGS+=-fPIC -pthread"
@@ -100,7 +101,6 @@ build_config()
                echo "LDFLAGS+=-Wl,--no-undefined -Wl,--as-needed"
                ;;
                FreeBSD)
-               [ "$(uname -m)" = "amd64" -o "$(uname -m)" = "x86_64" ] && echo "ARCH_X86_64=1" && echo "CFLAGS+=-DARCH_X86_64"
                [ "$optimisations" = "true" ] &&
                        echo "OPTIMISATIONS+=-ffast-math"
                echo "CFLAGS+=-fPIC -pthread"
@@ -109,7 +109,6 @@ build_config()
                echo "LDFLAGS+=-Wl,--no-undefined -Wl,--as-needed"
                ;;
                NetBSD)
-               [ "$(uname -m)" = "amd64" ] && echo "ARCH_X86_64=1" && echo "CFLAGS+=-DARCH_X86_64"
                [ "$optimisations" = "true" ] &&
                        echo "OPTIMISATIONS+=-ffast-math"
                echo "CFLAGS+=-pthread"
@@ -118,7 +117,6 @@ build_config()
                echo "LDFLAGS+=-Wl,--no-undefined -Wl,--as-needed"
                ;;
                MinGW)
-               [ "$(uname -m)" = "x86_64" ] && echo "ARCH_X86_64=1" && echo "CFLAGS+=-DARCH_X86_64"
                [ "$optimisations" = "true" ] &&
                        echo "OPTIMISATIONS+=-ffast-math"
                echo "SHFLAGS=-shared"
@@ -193,33 +191,15 @@ export gpl=false
 export gpl3=false
 export arch=
 export cpu=
-export targetos=
-
-# Determine OS
-targetos=$(uname -s)
-# Chose appropriate suffix for libraries
-case $targetos in
-       Darwin)
-       LIBSUF=".dylib"
-       ;;
-       Linux|FreeBSD|NetBSD)
-       LIBSUF=".so"
-       ;;
-       MINGW32_NT-*)
-       targetos="MinGW"
-       LIBSUF=".dll"
-       ;;
-       *)
-       LIBSUF=".so"
-       ;;
-esac
-export LIBSUF
+export targetos=$(uname -s)
+export targetarch=
+export amd64=false
 
 # Iterate through arguments
 for i in "$@"
 do
        case $i in
-               --help )                        help=1 ;;
+               --help )                help=1 ;;
                --prefix=* )            prefix="${i#--prefix=}" ;;
                --libdir=* )            libdir="${i#--libdir=}" ;;
                --datadir=* )           datadir="${i#--datadir=}" ;;
@@ -231,11 +211,40 @@ do
                --disable-sse2 )        sse2=false ;;
                --enable-gpl )          gpl=true ;;
                --enable-gpl3 )         gpl3=true ;;
-               --arch=* )                      arch="${i#--arch=}" ;;
-               --cpu=* )                       cpu="${i#--cpu=}" ;;
+               --arch=* )              arch="${i#--arch=}" ;;
+               --cpu=* )               cpu="${i#--cpu=}" ;;
+               --target-os=* )         targetos="${i#--target-os=}" ;;
+               --target-arch=* )       targetarch="${i#--target-arch=}" ;;
        esac
 done
 
+# Chose appropriate suffix for libraries
+case $targetos in
+       Darwin)
+       LIBSUF=".dylib"
+       if [ "$targetarch" = "" ]
+       then
+               sysctl -a hw | grep "x86_64: 1" > /dev/null
+               [ "$?" = "0" ] && targetarch="amd64"
+       fi
+       ;;
+       Linux|FreeBSD|NetBSD)
+       LIBSUF=".so"
+       ;;
+       MINGW32_NT-*|MinGW|mingw)
+       targetos="MinGW"
+       LIBSUF=".dll"
+       ;;
+       *)
+       LIBSUF=".so"
+       ;;
+esac
+export LIBSUF
+
+# Determine if we are compiling for 64-bit Intel architecture
+[ "$targetarch" = "" ] && targetarch=$(uname -m)
+[ "$targetarch" = "amd64" -o "$targetarch" = "x86_64" ] && amd64=true
+
 # Determine the libdir if it's not specified in the args
 [ "$libdir" = "" ] && libdir=$prefix/lib
 [ "$datadir" = "" ] && datadir=$prefix/share
index 98e470af90d2fa6d59949a27e307de51bb58fd0e..0a4d37a187b657ca7bb63420b693f3a7d7b7bb81 100755 (executable)
@@ -18,6 +18,6 @@ case $targetos in
        MinGW)
                echo LIBSUF=.dll
                echo "CXXFLAGS+=-Wall $WARNINGS -DPIC"
-               echo "LIBFLAGS=-enable-auto-import -shared"
+               echo "LIBFLAGS=-Wl,-enable-auto-import -shared"
                ;;
 esac >> config.mak
index d97aad5682b807e471cfc427767cf9b79d5c6c9b..b85606854cbb1a09e68df5d19b10b66a7c75857a 100755 (executable)
@@ -31,8 +31,8 @@ else
                ;;
        esac
 
-       qimage_includedir=/usr/include/qt4
-       qimage_libdir=/usr/lib/qt4
+       qimage_includedir=
+       qimage_libdir=
 
        if [ ! -d "$qimage_libdir" -o ! -d "$qimage_includedir" ]
        then
@@ -95,19 +95,8 @@ else
                fi
        fi
 
-       pkg-config --exists 'QtGui >= 4'
-       if [ $? -eq 0 ] && [ "$force_qt3" = "" ]
+       if [ -d "$qimage_libdir" -a -d "$qimage_includedir" ]
        then
-               echo "Qt version 4.x detected, will compile Qt4 qimage producer"
-               qt4_found=true
-               echo "#define USE_QT4" >> config.h
-               echo "USE_QT4=1" >> config.mak
-               echo QTCXXFLAGS=$(pkg-config --cflags QtCore QtGui QtXml QtSvg ) >> config.mak
-               echo QTLIBS=$(pkg-config --libs QtCore QtGui QtXml QtSvg) >> config.mak
-               
-       elif [ -d "$qimage_libdir" -a -d "$qimage_includedir" ]
-       then
-
                # test if we have a Qt3 or Qt4
                if [ -f "$qimage_libdir/libQtCore.so" ] || [ -d "$qimage_libdir/QtGui.framework" ] || [ -f "$qimage_libdir/libQtCore4.a" ] && [ "$force_qt3" = "" ]
                then
@@ -130,7 +119,7 @@ else
                        elif [ -f "$qimage_libdir/libQtCore4.a" ]
                        then
                                echo QTCXXFLAGS=-I$qimage_includedir >> config.mak
-                               echo QTLIBS=-enable-auto-import -L$qimage_libdir -lQtCore4 -lQtGui4 -lQtXml4 -lQtSvg4 >> config.mak
+                               echo QTLIBS=-Wl,-enable-auto-import -L$qimage_libdir -lQtCore4 -lQtGui4 -lQtXml4 -lQtSvg4 >> config.mak
                        else
                                echo QTCXXFLAGS=-I$qimage_includedir >> config.mak
                                echo QTLIBS=-L$qimage_libdir -lQtCore -lQtGui -lQtXml -lQtSvg >> config.mak
@@ -153,8 +142,19 @@ else
                    fi
                fi
        else
-               echo "qimage: QT environment not found - disabling"
-               touch ../disable-qimage
+               pkg-config --exists 'QtGui >= 4'
+               if [ $? -eq 0 ] && [ "$force_qt3" = "" ]
+               then
+                       echo "Qt version 4.x detected, will compile Qt4 qimage producer"
+                       qt4_found=true
+                       echo "#define USE_QT4" >> config.h
+                       echo "USE_QT4=1" >> config.mak
+                       echo QTCXXFLAGS=$(pkg-config --cflags QtCore QtGui QtXml QtSvg ) >> config.mak
+                       echo QTLIBS=$(pkg-config --libs QtCore QtGui QtXml QtSvg) >> config.mak
+               else
+                       echo "qimage: QT environment not found - disabling"
+                       touch ../disable-qimage
+               fi
        fi
        [ "$gpl3" = "true" ] && echo GPL3=1 >> config.mak
        exit 0
index 32d5d5d4b6fd84713c90632a77bc22dbf29786ad..e6839e73e916ec64869f8412a43222f92c9e1830 100644 (file)
@@ -10,7 +10,7 @@ TARGET = ../libmltswfdec$(LIBSUF)
 OBJS = producer_swfdec.o
 
 ifeq ($(targetos), MinGW)
-LDFLAGS += -enable-auto-import -lz
+LDFLAGS += -Wl,enable-auto-import -lz
 endif
 
 SRCS := $(OBJS:.o=.c)
index 8d39cec6ecd4ce11a80dad116fd4de3c7866970a..1585153597cdb798e72249a6df421cf8c54ee51c 100644 (file)
@@ -18,7 +18,7 @@
 #include <stdlib.h>
 #include <math.h>
 #include <string.h>
-#if !defined(__DARWIN__) && !defined(__FreeBSD__)
+#if !defined(__DARWIN__) && !defined(__FreeBSD__) && !defined(WIN32)
 #include <values.h>
 #endif