diff --git a/CMake/win32-cache.cmake b/CMake/win32-cache.cmake index 60d638f2d9..77535a6367 100644 --- a/CMake/win32-cache.cmake +++ b/CMake/win32-cache.cmake @@ -33,7 +33,6 @@ if(MINGW) set(HAVE_GETTIMEOFDAY 1) set(HAVE_LIBGEN_H 1) set(HAVE_OPENDIR 1) - set(HAVE_SNPRINTF 1) set(HAVE_STDBOOL_H 1) set(HAVE_STDDEF_H 1) # detected by CMake internally in check_type_size() set(HAVE_STDINT_H 1) # detected by CMake internally in check_type_size() @@ -60,11 +59,6 @@ else() set(HAVE_STDBOOL_H 0) endif() set(HAVE_BOOL_T "${HAVE_STDBOOL_H}") - if(MSVC_VERSION GREATER_EQUAL 1900) - set(HAVE_SNPRINTF 1) - else() - set(HAVE_SNPRINTF 0) - endif() set(HAVE_BASENAME 0) endif() endif() diff --git a/CMakeLists.txt b/CMakeLists.txt index 43fb01a48a..96d409b556 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1633,6 +1633,7 @@ if(NOT WIN32) check_function_exists("if_nametoindex" HAVE_IF_NAMETOINDEX) # net/if.h check_function_exists("realpath" HAVE_REALPATH) check_function_exists("sched_yield" HAVE_SCHED_YIELD) + check_function_exists("snprintf" HAVE_SNPRINTF) # to match detection method in ./configure check_symbol_exists("strcasecmp" "string.h" HAVE_STRCASECMP) check_symbol_exists("stricmp" "string.h" HAVE_STRICMP) check_symbol_exists("strcmpi" "string.h" HAVE_STRCMPI) @@ -1646,11 +1647,6 @@ if(NOT _ssl_enabled) check_symbol_exists("arc4random" "${CURL_INCLUDES};stdlib.h" HAVE_ARC4RANDOM) endif() -if(NOT MSVC) - check_function_exists("snprintf" HAVE_SNPRINTF) # to match detection method in ./configure -elseif(MSVC_VERSION GREATER_EQUAL 1900) # Earlier MSVC compilers had faulty snprintf implementations - check_symbol_exists("snprintf" "stdio.h" HAVE_SNPRINTF) # snprintf may be a compatibility macro, not an exported function -endif() if(APPLE) check_function_exists("mach_absolute_time" HAVE_MACH_ABSOLUTE_TIME) endif() diff --git a/configure.ac b/configure.ac index d345f5f354..f924054c67 100644 --- a/configure.ac +++ b/configure.ac @@ -4190,7 +4190,6 @@ AC_CHECK_FUNCS([\ sendmsg \ setlocale \ setrlimit \ - snprintf \ utime \ utimes \ ]) @@ -4200,6 +4199,7 @@ if test "$curl_cv_native_windows" != "yes"; then if_nametoindex \ realpath \ sched_yield \ + snprintf \ ]) CURL_CHECK_FUNC_INET_NTOP CURL_CHECK_FUNC_INET_PTON diff --git a/lib/config-win32.h b/lib/config-win32.h index dd93c04579..c62ba8fc5a 100644 --- a/lib/config-win32.h +++ b/lib/config-win32.h @@ -159,11 +159,6 @@ /* Define to the function return type for send. */ #define SEND_TYPE_RETV int -/* Define to 1 if you have the snprintf function. */ -#if (defined(_MSC_VER) && (_MSC_VER >= 1900)) || defined(__MINGW32__) -#define HAVE_SNPRINTF 1 -#endif - /* Must always use local implementations on Windows. */ /* Define to 1 if you have an IPv6 capable working inet_ntop function. */ /* #undef HAVE_INET_NTOP */