summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--config/cmake/ConfigureChecks.cmake16
-rw-r--r--config/cmake/H5pubconf.h.in3
-rw-r--r--src/H5FDstdio.c6
-rw-r--r--src/H5win32defs.h6
4 files changed, 24 insertions, 7 deletions
diff --git a/config/cmake/ConfigureChecks.cmake b/config/cmake/ConfigureChecks.cmake
index 963152c..0a078b6 100644
--- a/config/cmake/ConfigureChecks.cmake
+++ b/config/cmake/ConfigureChecks.cmake
@@ -129,6 +129,10 @@ ENDMACRO (CHECK_LIBRARY_EXISTS_CONCAT)
SET (WINDOWS)
IF (WIN32)
+ IF (MINGW)
+ SET (H5_HAVE_MINGW 1)
+ SET (WINDOWS 1) # MinGW tries to imitate Windows
+ ENDIF (MINGW)
SET (H5_HAVE_WIN32_API 1)
IF (NOT UNIX AND NOT CYGWIN AND NOT MINGW)
SET (WINDOWS 1)
@@ -174,7 +178,9 @@ IF (WINDOWS)
SET (H5_HAVE_DIFFTIME 1)
SET (H5_HAVE_LONGJMP 1)
SET (H5_STDC_HEADERS 1)
- SET (H5_HAVE_GETHOSTNAME 1)
+ IF (NOT MINGW)
+ SET (H5_HAVE_GETHOSTNAME 1)
+ ENDIF (NOT MINGW)
SET (H5_HAVE_GETCONSOLESCREENBUFFERINFO 1)
SET (H5_HAVE_FUNCTION 1)
SET (H5_GETTIMEOFDAY_GIVES_TZ 1)
@@ -295,7 +301,6 @@ ENDIF (H5_HAVE_STDINT_H AND CMAKE_CXX_COMPILER_LOADED)
SET (LINUX_LFS 0)
SET (HDF5_EXTRA_FLAGS)
-#IF (CMAKE_SYSTEM MATCHES "Linux-([3-9]\\.[0-9]|2\\.[4-9])\\.")
IF (NOT WINDOWS)
# Linux Specific flags
SET (HDF5_EXTRA_FLAGS -D_POSIX_SOURCE -D_BSD_SOURCE)
@@ -331,7 +336,6 @@ IF (NOT WINDOWS)
ENDIF (HDF5_ENABLE_LARGE_FILE)
SET (CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} ${HDF5_EXTRA_FLAGS})
ENDIF (NOT WINDOWS)
-#ENDIF (CMAKE_SYSTEM MATCHES "Linux-([3-9]\\.[0-9]|2\\.[4-9])\\.")
ADD_DEFINITIONS (${HDF5_EXTRA_FLAGS})
@@ -632,7 +636,8 @@ ENDIF (NOT WINDOWS)
#-----------------------------------------------------------------------------
# Check if InitOnceExecuteOnce is available
#-----------------------------------------------------------------------------
-IF (WINDOWS AND NOT HDF5_NO_IOEO_TEST)
+IF (WINDOWS)
+ IF (NOT HDF5_NO_IOEO_TEST)
MESSAGE (STATUS "Checking for InitOnceExecuteOnce:")
IF("${H5_HAVE_IOEO}" MATCHES "^${H5_HAVE_IOEO}$")
IF (LARGEFILE)
@@ -690,7 +695,8 @@ IF (WINDOWS AND NOT HDF5_NO_IOEO_TEST)
"Return value: ${HAVE_IOEO_EXITCODE}\n")
ENDIF("${HAVE_IOEO_EXITCODE}" EQUAL 0)
ENDIF("${H5_HAVE_IOEO}" MATCHES "^${H5_HAVE_IOEO}$")
-ENDIF (WINDOWS AND NOT HDF5_NO_IOEO_TEST)
+ ENDIF (NOT HDF5_NO_IOEO_TEST)
+ENDIF (WINDOWS)
#-----------------------------------------------------------------------------
diff --git a/config/cmake/H5pubconf.h.in b/config/cmake/H5pubconf.h.in
index b2567b5..80406a3 100644
--- a/config/cmake/H5pubconf.h.in
+++ b/config/cmake/H5pubconf.h.in
@@ -6,6 +6,9 @@
/* Define if the Windows virtual file driver should be compiled */
#cmakedefine H5_HAVE_WINDOWS @H5_HAVE_WINDOWS@
+/* Define if using MinGW */
+#cmakedefine H5_HAVE_MINGW @H5_HAVE_MINGW@
+
/* Define if on the Windows platform and default WIN32 API */
#cmakedefine H5_HAVE_WIN32_API @H5_HAVE_WIN32_API@
diff --git a/src/H5FDstdio.c b/src/H5FDstdio.c
index b67e01e..49e1957 100644
--- a/src/H5FDstdio.c
+++ b/src/H5FDstdio.c
@@ -44,6 +44,10 @@
#endif
#ifdef H5_HAVE_WIN32_API
+/* The following two defines must be before any windows headers are included */
+#define WIN32_LEAN_AND_MEAN /* Exclude rarely-used stuff from Windows headers */
+#define NOGDI /* Exclude Graphic Display Interface macros */
+
#include <windows.h>
#include <io.h>
@@ -115,10 +119,12 @@ typedef struct H5FD_stdio_t {
/* Use similar structure as in H5private.h by defining Windows stuff first. */
#ifdef H5_HAVE_WIN32_API
+ #ifndef H5_HAVE_MINGW
# define file_fseek _fseeki64
# define file_offset_t __int64
# define file_ftruncate _chsize_s /* Supported in VS 2005 or newer */
# define file_ftell _ftelli64
+ #endif
#endif
/* Use file_xxx to indicate these are local macros, avoiding confusing
diff --git a/src/H5win32defs.h b/src/H5win32defs.h
index 5f886d1..e9b87625 100644
--- a/src/H5win32defs.h
+++ b/src/H5win32defs.h
@@ -33,9 +33,7 @@ typedef __int64 h5_stat_size_t;
#define HDdup(F) _dup(F)
#define HDfdopen(N,S) _fdopen(N,S)
#define HDfileno(F) _fileno(F)
-#define HDfseek(F,O,W) _fseeki64(F,O,W)
#define HDfstat(F,B) _fstati64(F,B)
-#define HDftruncate(F,L) _chsize_s(F,L)
#define HDisatty(F) _isatty(F)
#define HDgetcwd(S,Z) _getcwd(S,Z)
#define HDgetdcwd(D,S,Z) _getdcwd(D,S,Z)
@@ -91,4 +89,8 @@ struct timezone {
* type cannot be cast as a ulong like other systems. */
#define HDpthread_self_ulong() ((unsigned long)GetCurrentThreadId())
+#ifndef H5_HAVE_MINGW
+#define HDftruncate(F,L) _chsize_s(F,L)
+#define HDfseek(F,O,W) _fseeki64(F,O,W)
+#endif
#endif /* H5_HAVE_WIN32_API */