From 19f6b919af232c56d82b06728fec225d208cd648 Mon Sep 17 00:00:00 2001 From: Klaas Freitag Date: Mon, 22 Apr 2013 13:50:59 +0200 Subject: [PATCH] Use __mingw_asprintf if asprintf is not available. --- ConfigureChecks.cmake | 3 +++ config.h.cmake | 2 ++ src/std/c_private.h | 4 ++++ 3 files changed, 9 insertions(+) diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake index 0712dbeb61..e199e5435f 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 2685aadf06..d139295f37 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 aec65029ba..94499c9f48 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