Merge commit 'a6f19d6a9f8d1e08653d9d77581e8c823f4955c2'
authorMichael Niedermayer <michaelni@gmx.at>
Mon, 8 Jun 2015 18:39:38 +0000 (20:39 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Mon, 8 Jun 2015 18:39:38 +0000 (20:39 +0200)
* commit 'a6f19d6a9f8d1e08653d9d77581e8c823f4955c2':
  configure: Support MSVC 2015

Conflicts:
configure
libavutil/internal.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
1  2 
configure
libavutil/internal.h

diff --cc configure
+++ b/configure
@@@ -3593,38 -3041,9 +3593,30 @@@ probe_cc()
          _ld_path='-libpath:'
          # -Qdiag-error to make icl error when seeing certain unknown arguments
          _flags='-nologo -Qdiag-error:4044,10157'
 -        # -Qvec- -Qsimd- to prevent miscompilation, -GS for consistency
 +        # -Qvec- -Qsimd- to prevent miscompilation, -GS, fp:precise for consistency
          # with MSVC which enables it by default.
 -        _cflags='-D_USE_MATH_DEFINES -FIstdlib.h -Dstrtoll=_strtoi64 -Qms0 -Qvec- -Qsimd- -GS'
 +        _cflags='-D_USE_MATH_DEFINES -FIstdlib.h -Dstrtoll=_strtoi64 -Qms0 -Qvec- -Qsimd- -GS -fp:precise'
-         if [ $pfx = hostcc ]; then
-             append _cflags -Dsnprintf=_snprintf
-         fi
 +        disable stripping
 +    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"
 +        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 -D_CRT_SECURE_NO_WARNINGS -Dinline=__inline -FIstdlib.h -Dstrtoll=_strtoi64'
-         if [ $pfx = hostcc ]; then
-             if [ -z "$cl_major_ver" ] || [ $cl_major_ver -le 18 ]; then
-                 append _cflags -Dsnprintf=_snprintf
-             fi
-         fi
 +        disable stripping
      elif $_cc --version 2>/dev/null | grep -q ^cparser; then
          _type=cparser
          _ident=$($_cc --version | head -n1)
      }\
  }
  
 +#define FF_ALLOC_ARRAY_OR_GOTO(ctx, p, nelem, elsize, label)\
 +{\
 +    p = av_malloc_array(nelem, elsize);\
 +    if (!p) {\
 +        av_log(ctx, AV_LOG_ERROR, "Cannot allocate memory.\n");\
 +        goto label;\
 +    }\
 +}
 +
 +#define FF_ALLOCZ_ARRAY_OR_GOTO(ctx, p, nelem, elsize, label)\
 +{\
 +    p = av_mallocz_array(nelem, elsize);\
 +    if (!p) {\
 +        av_log(ctx, AV_LOG_ERROR, "Cannot allocate memory.\n");\
 +        goto label;\
 +    }\
 +}
 +
  #include "libm.h"
  
- #if defined(_MSC_VER) && _MSC_VER < 1900
- #pragma comment(linker, "/include:"EXTERN_PREFIX"avpriv_strtod")
- #pragma comment(linker, "/include:"EXTERN_PREFIX"avpriv_snprintf")
- #endif
  /**
   * Return NULL if CONFIG_SMALL is true, otherwise the argument
   * without modification. Used to disable the definition of strings
@@@ -241,12 -203,13 +236,18 @@@ void avpriv_request_sample(void *avc
                             const char *msg, ...) av_printf_format(2, 3);
  
  #if HAVE_LIBC_MSVCRT
+ #include <crtversion.h>
+ #if defined(_VC_CRT_MAJOR_VERSION) && _VC_CRT_MAJOR_VERSION < 14
+ #pragma comment(linker, "/include:"EXTERN_PREFIX"avpriv_strtod")
+ #pragma comment(linker, "/include:"EXTERN_PREFIX"avpriv_snprintf")
+ #endif
  #define avpriv_open ff_open
 +#define PTRDIFF_SPECIFIER "Id"
 +#define SIZE_SPECIFIER "Iu"
 +#else
 +#define PTRDIFF_SPECIFIER "td"
 +#define SIZE_SPECIFIER "zu"
  #endif
  
  /**