Module: libav Branch: release/11 Commit: a24aa919a2cb009abfab4b6d8bca4a442e9dae4f
Author: Luca Barbato <[email protected]> Committer: Luca Barbato <[email protected]> Date: Fri Jun 5 15:07:06 2015 +0200 configure: Support MSVC 2015 The C runtime C99 compatibility had been improved a lot and it now rejects some of the compatibility defines provided for the older versions. Many thanks to Ray for the time spent testing. Bug-Id: 864 CC: [email protected] --- configure | 22 ++++++++++------------ libavutil/internal.h | 11 ++++++----- 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/configure b/configure index 34ec7a4..7d5f7f8 100755 --- a/configure +++ b/configure @@ -2928,9 +2928,6 @@ probe_cc(){ _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 - append _cflags -Dsnprintf=_snprintf - fi elif $_cc 2>&1 | grep -q Intel; then _type=icl _ident=$($cc 2>&1 | head -n1) @@ -2954,9 +2951,6 @@ probe_cc(){ # -Qvec- -Qsimd- to prevent miscompilation, -GS for consistency # with MSVC which enables it by default. _cflags='-D_USE_MATH_DEFINES -FIstdlib.h -Dstrtoll=_strtoi64 -Qms0 -Qvec- -Qsimd- -GS' - if [ $pfx = hostcc ]; then - append _cflags -Dsnprintf=_snprintf - fi elif $_cc --version 2>/dev/null | grep -q ^cparser; then _type=cparser _ident=$($_cc --version | head -n1) @@ -3639,6 +3633,16 @@ probe_libc(){ add_${pfx}cppflags -D__printf__=__gnu_printf__ elif check_${pfx}cpp_condition crtversion.h "defined _VC_CRT_MAJOR_VERSION"; then eval ${pfx}libc_type=msvcrt + if check_${pfx}cpp_condition crtversion.h "_VC_CRT_MAJOR_VERSION < 14"; then + if [ "$pfx" = host_ ]; then + add_host_cppflags -Dsnprintf=_snprintf + else + add_compat strtod.o strtod=avpriv_strtod + add_compat msvcrt/snprintf.o snprintf=avpriv_snprintf \ + _snprintf=avpriv_snprintf \ + vsnprintf=avpriv_vsnprintf + fi + fi # The MSVC 2010 headers (Win 7.0 SDK) set _WIN32_WINNT to # 0x601 by default unless something else is set by the user. # This can easily lead to us detecting functions only present @@ -3666,12 +3670,6 @@ case $libc_type in bionic) add_compat strtod.o strtod=avpriv_strtod ;; - msvcrt) - add_compat strtod.o strtod=avpriv_strtod - add_compat msvcrt/snprintf.o snprintf=avpriv_snprintf \ - _snprintf=avpriv_snprintf \ - vsnprintf=avpriv_vsnprintf - ;; esac # hacks for compiler/libc/os combinations diff --git a/libavutil/internal.h b/libavutil/internal.h index aed9925..f1e78bf 100644 --- a/libavutil/internal.h +++ b/libavutil/internal.h @@ -134,11 +134,6 @@ #include "libm.h" -#if defined(_MSC_VER) -#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 @@ -212,6 +207,12 @@ 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 #endif _______________________________________________ libav-commits mailing list [email protected] https://lists.libav.org/mailman/listinfo/libav-commits
