]> git.sesse.net Git - x264/blobdiff - configure
matroska: mk_close: Check fseek() return value
[x264] / configure
index 0e9df9d39a81809eb733c6cfd79225d9f2a9fe7b..741f6d69e87dcb787bd4caa7ba0279d2917fc7d7 100755 (executable)
--- a/configure
+++ b/configure
@@ -28,7 +28,7 @@ Configuration options:
   --disable-opencl         disable OpenCL features
   --disable-gpl            disable GPL-only features
   --disable-thread         disable multithreaded encoding
-  --enable-win32thread     use win32threads (windows only)
+  --disable-win32thread    disable win32threads (windows only)
   --disable-interlaced     disable interlaced encoding support
   --bit-depth=BIT_DEPTH    set output bit depth (8-10) [8]
   --chroma-format=FORMAT   output chroma format (420, 422, 444, all) [all]
@@ -373,7 +373,7 @@ NL="
 # list of all preprocessor HAVE values we can define
 CONFIG_HAVE="MALLOC_H ALTIVEC ALTIVEC_H MMX ARMV6 ARMV6T2 NEON BEOSTHREAD POSIXTHREAD WIN32THREAD THREAD LOG2F SWSCALE \
              LAVF FFMS GPAC AVS GPL VECTOREXT INTERLACED CPU_COUNT OPENCL THP LSMASH X86_INLINE_ASM AS_FUNC INTEL_DISPATCHER \
-             MSA"
+             MSA MMAP"
 
 # parse options
 
@@ -446,8 +446,8 @@ for opt do
         --disable-thread)
             thread="no"
             ;;
-        --enable-win32thread)
-            thread="win32"
+        --disable-win32thread)
+            [ "$thread" != "no" ] && thread="posix"
             ;;
         --disable-swscale)
             swscale="no"
@@ -601,29 +601,18 @@ case $host_os in
         define HAVE_MALLOC_H
         libm="-lm"
         ;;
-    cygwin*)
+    cygwin*|mingw*|msys*)
         EXE=".exe"
-        if [ $compiler_style = GNU ] && cc_check "" -mno-cygwin; then
-            CFLAGS="$CFLAGS -mno-cygwin"
-            LDFLAGS="$LDFLAGS -mno-cygwin"
-        fi
-        if cpp_check "" "" "defined(__CYGWIN__)" ; then
-            define HAVE_MALLOC_H
+        if [[ $host_os = cygwin* ]] && cpp_check "" "" "defined(__CYGWIN__)" ; then
             SYS="CYGWIN"
+            define HAVE_MALLOC_H
         else
             SYS="WINDOWS"
             DEVNULL="NUL"
             LDFLAGSCLI="$LDFLAGSCLI -lshell32"
-            RC="${RC-${cross_prefix}windres}"
+            [ $compiler = GNU ] && RC="${RC-${cross_prefix}windres}" || RC="${RC-rc}"
         fi
         ;;
-    mingw*)
-        SYS="WINDOWS"
-        EXE=".exe"
-        DEVNULL="NUL"
-        LDFLAGSCLI="$LDFLAGSCLI -lshell32"
-        [ $compiler = GNU ] && RC="${RC-${cross_prefix}windres}" || RC="${RC-rc}"
-        ;;
     sunos*|solaris*)
         SYS="SunOS"
         define HAVE_MALLOC_H
@@ -924,11 +913,25 @@ fi
 
 # autodetect options that weren't forced nor disabled
 
-# pthread-win32 is lgpl, prevent its use if --disable-gpl is specified and targeting windows
-[ "$SYS" = "WINDOWS" -a "$gpl" = "no" -a "$thread" = "auto" ] && thread="win32"
-
 libpthread=""
-if [ "$thread" = "auto" ]; then
+if [ "$SYS" = "WINDOWS" -a "$thread" = "posix" ] ; then
+    if [ "$gpl" = "no" ] ; then
+        echo "Warning: pthread-win32 is LGPL and is therefore not supported with --disable-gpl"
+        thread="no"
+    elif cc_check pthread.h -lpthread "pthread_create(0,0,0,0);" ; then
+        libpthread="-lpthread"
+    elif cc_check pthread.h -lpthreadGC2 "pthread_create(0,0,0,0);" ; then
+        libpthread="-lpthreadGC2"
+    elif cc_check pthread.h "-lpthreadGC2 -lwsock32 -DPTW32_STATIC_LIB" "pthread_create(0,0,0,0);" ; then
+        libpthread="-lpthreadGC2 -lwsock32"
+        define PTW32_STATIC_LIB
+    elif cc_check pthread.h "-lpthreadGC2 -lws2_32 -DPTW32_STATIC_LIB" "pthread_create(0,0,0,0);" ; then
+        libpthread="-lpthreadGC2 -lws2_32"
+        define PTW32_STATIC_LIB
+    else
+        thread="no"
+    fi
+elif [ "$thread" != "no" ] ; then
     thread="no"
     case $SYS in
         BEOS)
@@ -936,24 +939,8 @@ if [ "$thread" = "auto" ]; then
             define HAVE_BEOSTHREAD
             ;;
         WINDOWS)
-            if cc_check pthread.h -lpthread "pthread_create(0,0,0,0);" ; then
-                thread="posix"
-                libpthread="-lpthread"
-            elif cc_check pthread.h -lpthreadGC2 "pthread_create(0,0,0,0);" ; then
-                thread="posix"
-                libpthread="-lpthreadGC2"
-            elif cc_check pthread.h "-lpthreadGC2 -lwsock32 -DPTW32_STATIC_LIB" "pthread_create(0,0,0,0);" ; then
-                thread="posix"
-                libpthread="-lpthreadGC2 -lwsock32"
-                define PTW32_STATIC_LIB
-            elif cc_check pthread.h "-lpthreadGC2 -lws2_32 -DPTW32_STATIC_LIB" "pthread_create(0,0,0,0);" ; then
-                thread="posix"
-                libpthread="-lpthreadGC2 -lws2_32"
-                define PTW32_STATIC_LIB
-            else
-                # default to native threading if pthread-win32 is unavailable
-                thread="win32"
-            fi
+            thread="win32"
+            define HAVE_WIN32THREAD
             ;;
         QNX)
             cc_check pthread.h -lc "pthread_create(0,0,0,0);" && thread="posix" && libpthread="-lc"
@@ -975,20 +962,16 @@ if [ "$thread" = "posix" ]; then
         define HAVE_CPU_COUNT
     fi
 fi
-if [ "$thread" = "win32" ]; then
-    # cygwin does not support win32 threads
-    if [ "$SYS" = "WINDOWS" ]; then
-        define HAVE_WIN32THREAD
-    else
-        thread="no"
-    fi
-fi
 [ "$thread" != "no" ] && define HAVE_THREAD
 
 if cc_check "math.h" "-Werror" "return log2f(2);" ; then
     define HAVE_LOG2F
 fi
 
+if [ "$SYS" != "WINDOWS" ] && cpp_check "sys/mman.h unistd.h" "" "defined(MAP_PRIVATE)"; then
+    define HAVE_MMAP
+fi
+
 if [ "$SYS" = "LINUX" -a \( "$ARCH" = "X86" -o "$ARCH" = "X86_64" \) ] && cc_check "sys/mman.h" "" "MADV_HUGEPAGE;" ; then
     define HAVE_THP
 fi