]> git.sesse.net Git - x264/blobdiff - configure
if --threads > 1, then read the input stream in its own thread.
[x264] / configure
index 8b51478f46143e8cf3b9771b351897694457698c..74d445f5cd6133a15b46e07ab28d566786a39f2d 100755 (executable)
--- a/configure
+++ b/configure
@@ -15,6 +15,7 @@ echo "  --enable-debug           adds -g, doesn't strip"
 echo "  --enable-gprof           adds -pg, doesn't strip"
 echo "  --enable-visualize       enables visualization (X11 only)"
 echo "  --enable-pic             build position-independent code"
+echo "  --enable-shared          build libx264.so"
 echo "  --extra-asflags=EASFLAGS add EASFLAGS to ASFLAGS"
 echo "  --extra-cflags=ECFLAGS   add ECFLAGS to CFLAGS"
 echo "  --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS"
@@ -51,6 +52,7 @@ gprof="no"
 pic="no"
 vfw="no"
 vis="no"
+shared="no"
 
 CC="gcc"
 CFLAGS="-Wall -I. -O4 -ffast-math -D__X264__"
@@ -58,7 +60,7 @@ LDFLAGS=""
 HAVE_GETOPT_LONG=1
 
 AS="nasm"
-ASFLAGS="-f elf -DFORMAT_ELF"
+ASFLAGS=""
 
 EXE=""
 
@@ -90,17 +92,13 @@ case "$UNAMES" in
     SYS="CYGWIN"
     CFLAGS="$CFLAGS -mno-cygwin"
     LDFLAGS="$LDFLAGS -mno-cygwin"
-    ASFLAGS="-f win32 -DPREFIX"
     EXE=".exe"
     DEVNULL="NUL"
-    vfw="yes"
     ;;
   MINGW*)
     SYS="MINGW"
-    ASFLAGS="-f win32 -DPREFIX"
     EXE=".exe"
     DEVNULL="NUL"
-    vfw="yes"
     ;;
   SunOS)
     SYS="SunOS"
@@ -119,11 +117,16 @@ case "$UNAMEM" in
   i386|i486|i586|i686|BePC)
     ARCH="X86"
     CFLAGS="$CFLAGS -DHAVE_MMXEXT -DHAVE_SSE2"
+    AS="nasm"
+    ASFLAGS="-O2"
     if [ "$SYS" = MACOSX ]; then
-      ASFLAGS="-f macho -DPREFIX -DFORMAT_MACHO"
-    fi
-    if [ "$SYS" = FREEBSD -o "$SYS" = NETBSD ]; then
-      ASFLAGS="-f aoutb -DFORMAT_AOUTB"
+      ASFLAGS="$ASFLAGS -f macho -DPREFIX"
+    elif [ "$SYS" = CYGWIN -o "$SYS" = MINGW ]; then
+      ASFLAGS="$ASFLAGS -f win32 -DPREFIX"
+    elif [ "$SYS" = NETBSD ]; then
+      ASFLAGS="$ASFLAGS -f aoutb"
+    else
+      ASFLAGS="$ASFLAGS -f elf"
     fi
     ;;
   x86_64)
@@ -239,8 +242,6 @@ for opt do
             gprof="yes"
             ;;
         --enable-pic)
-            CFLAGS="$CFLAGS -fPIC"
-            ASFLAGS="$ASFLAGS -D__PIC__"
             pic="yes"
             ;;
         --enable-vfw)
@@ -249,6 +250,12 @@ for opt do
         --disable-vfw)
             vfw="no"
             ;;
+        --enable-shared)
+            shared="yes"
+            if [ $ARCH = "X86_64" -o $ARCH = "PPC" -o $ARCH = "ALPHA" ] ; then
+                pic="yes"
+            fi
+            ;;
         --enable-visualize)
             LDFLAGS="$LDFLAGS -L/usr/X11R6/lib -lX11"
             CFLAGS="$CFLAGS -DVISUALIZE=1"
@@ -274,7 +281,7 @@ if test "$pthread" = "auto" ; then
     esac
 fi
 if test "$pthread" = "yes" ; then
-    CFLAGS="$CFLAGS -DHAVE_PTHREAD=1"
+    CFLAGS="$CFLAGS -DHAVE_PTHREAD"
     case $SYS in
         MINGW|CYGWIN|BEOS)
             ;;
@@ -308,6 +315,11 @@ if [ "$avis_input" = "yes" ] ; then
     LDFLAGS="$LDFLAGS -lvfw32"
 fi
 
+if [ "$pic" = "yes" ] ; then
+    CFLAGS="$CFLAGS -fPIC"
+    ASFLAGS="$ASFLAGS -D__PIC__"
+fi
+
 if [ "$debug" != "yes" -a "$gprof" != "yes" ]; then
     CFLAGS="$CFLAGS -s -fomit-frame-pointer"
     LDFLAGS="$LDFLAGS -s"
@@ -354,6 +366,12 @@ EOF
     echo "default: x264vfw.dll" >> config.mak
 fi
 
+if [ "$shared" = "yes" ]; then
+    API=`grep '#define X264_BUILD' < x264.h | cut -f 3 -d ' '`
+    echo "SONAME=libx264.so.$API" >> config.mak
+    echo 'default: $(SONAME)' >> config.mak
+fi
+
 ./version.sh
 
 cat > x264.pc << EOF
@@ -379,6 +397,7 @@ echo "vfw:        $vfw"
 echo "debug:      $debug"
 echo "gprof:      $gprof"
 echo "PIC:        $pic"
+echo "shared:     $shared"
 echo "visualize:  $vis"
 echo
 echo "You can run 'make' or 'make fprofiled' now."