diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake index 0712dbeb6..e199e5435 100644 --- a/ConfigureChecks.cmake +++ b/ConfigureChecks.cmake @@ -58,6 +58,9 @@ check_function_exists(strerror_r HAVE_STRERROR_R) check_function_exists(utimes HAVE_UTIMES) check_function_exists(lstat HAVE_LSTAT) check_function_exists(asprintf HAVE_ASPRINTF) +if (WIN32) + check_function_exists(__mingw_asprintf HAVE___MINGW_ASPRINTF) +endif(WIN32) if (UNIX AND HAVE_ASPRINTF) add_definitions(-D_GNU_SOURCE) endif (UNIX AND HAVE_ASPRINTF) diff --git a/config.h.cmake b/config.h.cmake index 2685aadf0..d139295f3 100644 --- a/config.h.cmake +++ b/config.h.cmake @@ -22,3 +22,5 @@ #cmakedefine HAVE_FNMATCH 1 #cmakedefine NEON_WITH_LFS 1 +#cmakedefine HAVE___MINGW_ASPRINTF 1 + diff --git a/src/std/c_private.h b/src/std/c_private.h index aec65029b..94499c9f4 100644 --- a/src/std/c_private.h +++ b/src/std/c_private.h @@ -72,6 +72,10 @@ typedef struct stat csync_stat_t; #define O_NOATIME 0 #endif +#if !defined(HAVE_ASPRINTF) && defined(HAVE___MINGW_ASPRINTF) +#define asprintf __mingw_asprintf +#endif + /* tchar definitions for clean win32 filenames */ #define _UNICODE