if ((client == NULL) || (path == NULL) || (client->sd_path == NULL))
return (NULL);
+#ifndef __MINGW32__
if ((*client->sd_path == '/')
|| (strncmp ("unix:", client->sd_path, strlen ("unix:")) == 0))
is_unix = 1;
+#endif
if (is_unix)
{
-#ifdef WIN32
+#if defined(WIN32) && !defined(__MINGW32__)
#include "strftime.h"
#endif
#include <stdio.h>
#include <string.h>
+#include "rrd_config.h"
#ifdef _MSC_VER
#include "win32-glob.h" /* from https://sourceforge.net/projects/sox/ */
#include "dirent.h" /* from https://github.com/tronkko/dirent */
#include "asprintf.h" /* from http://asprintf.insanecoding.org */
#else
+#if defined(__MINGW32__) && !defined(HAVE_GLOB_H) /* MinGW has glob.h, MinGW-w64 not (yet?) */
+#include "win32/win32-glob.h" /* from https://sourceforge.net/projects/sox/ */
+#else
#include <glob.h>
+#endif
#include <dirent.h>
#endif
#include <sys/types.h>
#include <limits.h>
#include <locale.h>
#include <stdlib.h>
+#ifdef __MINGW32__
+#include <pthread.h>
+/* time.h of MinGW-w64 requires _POSIX_THREAD_SAFE_FUNCTIONS to be defined in order to provide
+ * localtime_r. _POSIX_THREAD_SAFE_FUNCTIONS is defined in pthread_unistd.h (included from pthread.h).
+ * Alternatives here would be to either include "rrd_tool.h" before <time.h> or remove include of <time.h>
+ * from rrd_rpncalc.c, because time.h is included via rrd_tool.h ...
+ * However, let's do it this way, by including pthread.h here, only if __MINGW32__ is defined,
+ * in order to avoid any changes concerning other systems. */
+#endif
#include <time.h>
#include "rrd_tool.h"
}
exit(0);
}
-#if defined(HAVE_OPENDIR) && defined(HAVE_READDIR) && defined(HAVE_CHDIR) && defined(HAVE_SYS_STAT_H)
+/* MinGW-w64 has not got getuid() and only 1 argument for mkdir() */
+#if defined(HAVE_OPENDIR) && defined(HAVE_READDIR) && defined(HAVE_CHDIR) && defined(HAVE_SYS_STAT_H) && !defined(__MINGW32__)
if (argc > 1 && strcmp("cd", argv[1]) == 0) {
if (argc != 3) {
printf("ERROR: invalid parameter count for cd\n");
#include "rrd.h"
-#if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__CYGWIN32__)
+#if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__CYGWIN32__) && !defined(__MINGW32__)
/* Win32 only includes */
#include "rrd_strtod.h"
-#if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__CYGWIN32__)
+#if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__CYGWIN32__) && !defined(__MINGW32__)
+/* Remark: HAVE_GETTIMEOFDAY could be used here alternatively */
/*
* WIN32 does not have gettimeofday and struct timeval. This is a quick and dirty