]> git.sesse.net Git - ffmpeg/blobdiff - configure
Merge remote-tracking branch 'qatar/master'
[ffmpeg] / configure
index 0c16c6721579af312483bb2a32e7ba6b08b7bedb..7fac4e9f1db4d246215e3b931ff52ba02e94f036 100755 (executable)
--- a/configure
+++ b/configure
@@ -1054,11 +1054,6 @@ cp_if_changed(){
     cp -f "$1" "$2"
 }
 
-force_include(){
-    flag=$(eval printf '%s%s\\n' '$FORCE_INC' $1)
-    append CFLAGS "$flag"
-}
-
 # CONFIG_LIST contains configurable options, while HAVE_LIST is for
 # system-dependent things.
 
@@ -1268,7 +1263,6 @@ HAVE_LIST="
     asm_types_h
     attribute_may_alias
     attribute_packed
-    broken_strtod
     cbrtf
     clock_gettime
     closesocket
@@ -1308,6 +1302,7 @@ HAVE_LIST="
     ibm_asm
     inet_aton
     inline_asm
+    io_h
     isatty
     isinf
     isnan
@@ -1336,6 +1331,7 @@ HAVE_LIST="
     mkstemp
     mm_empty
     mmap
+    msvcrt
     nanosleep
     PeekNamedPipe
     perl
@@ -1355,7 +1351,6 @@ HAVE_LIST="
     setrlimit
     Sleep
     sndio_h
-    snprintf
     socklen_t
     soundcard_h
     strerror_r
@@ -1902,7 +1897,7 @@ frei0r_src_filter_deps="frei0r dlopen"
 frei0r_src_filter_extralibs='$ldl'
 hqdn3d_filter_deps="gpl"
 movie_filter_deps="avcodec avformat"
-mp_filter_deps="gpl avcodec swscale postproc"
+mp_filter_deps="gpl avcodec swscale postproc inline_asm"
 mptestsrc_filter_deps="gpl"
 negate_filter_deps="lut_filter"
 resample_filter_deps="avresample"
@@ -2089,7 +2084,6 @@ CC_O='-o $@'
 CXX_C='-c'
 CXX_O='-o $@'
 LD_O='-o $@'
-FORCE_INC="-include"
 LD_LIB='-l%'
 LD_PATH='-L'
 HOSTCC_C='-c'
@@ -2377,6 +2371,26 @@ EOF
     die "Sanity test failed."
 fi
 
+msvc_flags(){
+    for flag; do
+        case $flag in
+            -fomit-frame-pointer) echo -Oy ;;
+            -g)                   echo -Z7 ;;
+            -Wall)                echo -W4 -wd4244 -wd4127 -wd4018 -wd4389 \
+                                       -wd4146 -wd4057 -wd4204 -wd4706 -wd4305 \
+                                       -wd4152 -wd4324 -we4013 -wd4100 -wd4214 \
+                                       -wd4996 ;;
+            -std=c99)             ;;
+            -fno-math-errno)      ;;
+            -fno-common)          ;;
+            -fno-signed-zeros)    ;;
+            -lz)                  echo zlib.lib ;;
+            -l*)                  echo ${flag#-l}.lib ;;
+            *)                    echo $flag ;;
+        esac
+    done
+}
+
 pgi_flags(){
     for flag; do
         case $flag in
@@ -2563,6 +2577,30 @@ probe_cc(){
         _cflags_size="-O2 -Munroll=c:1 $opt_common"
         _cflags_noopt="-O1"
         _flags_filter=pgi_flags
+    elif $_cc 2>&1 | grep -q Microsoft; then
+        _type=msvc
+        _ident=$($cc 2>&1 | head -n1)
+        _DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< 2>&1 | awk '\''/including/ { sub(/^.*file: */, ""); gsub(/\\/, "/"); if (!match($$0, / /)) print "$@:", $$0 }'\'' > $(@:.o=.d)'
+        _DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -showIncludes -Zs'
+        _cflags_speed="-O2"
+        _cflags_size="-O1"
+        # Nonstandard output options, to avoid msys path conversion issues, relies on wrapper to remap it
+        if $_cc 2>&1 | grep -q Linker; then
+            _ld_o='-out $@'
+        else
+            _ld_o='-Fe$@'
+        fi
+        _cc_o='-Fo $@'
+        _cc_e='-P -Fi $@'
+        _flags_filter=msvc_flags
+        _ld_lib='lib%.a'
+        _ld_path='-libpath:'
+        _flags='-nologo'
+        _cflags='-D_USE_MATH_DEFINES -Dinline=__inline -FIstdlib.h -Dstrtoll=_strtoi64'
+        if [ $pfx = hostcc ]; then
+            _cflags="$cflags -Dsnprintf=_snprintf"
+        fi
+        disable aligned_stack
     fi
 
     eval ${pfx}_type=\$_type
@@ -3125,6 +3163,12 @@ elif check_header _mingw.h; then
         die "ERROR: MinGW runtime version must be >= 3.15."
 elif check_cpp_condition newlib.h "defined _NEWLIB_VERSION"; then
     libc_type=newlib
+elif check_func_headers stdlib.h _get_doserrno; then
+    libc_type=msvcrt
+    add_cflags -Dstrtod=avpriv_strtod
+    add_cflags -Dsnprintf=avpriv_snprintf   \
+               -D_snprintf=avpriv_snprintf  \
+               -Dvsnprintf=avpriv_vsnprintf
 elif check_cpp_condition stddef.h "defined __KLIBC__"; then
     libc_type=klibc
 fi
@@ -3438,7 +3482,6 @@ check_func  mmap
 check_func  ${malloc_prefix}posix_memalign      && enable posix_memalign
 check_func_headers malloc.h _aligned_malloc     && enable aligned_malloc
 check_func  setrlimit
-check_func  snprintf
 check_func  strerror_r
 check_func  sched_getaffinity
 check_func  sysconf
@@ -3458,18 +3501,10 @@ check_func_headers windows.h Sleep
 check_func_headers windows.h VirtualAlloc
 check_func_headers glob.h glob
 
-# Check for MSVCRT; it has a broken strtod() that can't parse some input.
-# Use old dos symbol to detect it. If we are on mingw, it already provides
-# its own replacement and we don't need to redo that.
-if check_func _get_doserrno; then
-    if test $target_os != mingw32; then
-        enable broken_strtod
-    fi
-fi
-
 check_header dlfcn.h
 check_header dxva.h
 check_header dxva2api.h -D_WIN32_WINNT=0x0600
+check_header io.h
 check_header libcrystalhd/libcrystalhd_if.h
 check_header malloc.h
 check_header poll.h
@@ -3838,14 +3873,6 @@ elif enabled pathscale; then
     add_cflags -fstrict-overflow -OPT:wrap_around_unsafe_opt=OFF
 fi
 
-# If a missing snprintf/broken strtod is detected, force-include headers
-# that override prototypes and define it to a prefixed one implemented in
-# libavutil. We do this at the end since -I flags aren't set in configure,
-# and any additional check_cflags() beyond here will thus fail (because
-# it can't find these files, because the -I$(srcdir) wasn't set).
-enabled snprintf || force_include compat/snprintf.h
-enabled broken_strtod && force_include compat/strtod.h
-
 enabled_any $THREADS_LIST      && enable threads
 
 enabled asm || { arch=c; disable $ARCH_LIST $ARCH_EXT_LIST; }