summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDana Robinson <derobins@hdfgroup.org>2015-10-27 15:24:56 (GMT)
committerDana Robinson <derobins@hdfgroup.org>2015-10-27 15:24:56 (GMT)
commit84b1e9e137fc5fd395556bcaaa50eef09bc8723c (patch)
tree5f2eacc6d526709e618a393a52559152f9703326
parent239882bd80e9841719139347d8bbc37487656735 (diff)
downloadhdf5-84b1e9e137fc5fd395556bcaaa50eef09bc8723c.zip
hdf5-84b1e9e137fc5fd395556bcaaa50eef09bc8723c.tar.gz
hdf5-84b1e9e137fc5fd395556bcaaa50eef09bc8723c.tar.bz2
[svn-r28237] Merge of r28228-9 from trunk.
accum test still has issues Tested on: Ubuntu 15.04 (Linux 3.19 x86_64) gcc 4.9.2 serial autotools and CMake (3.3.2)
-rw-r--r--CMakeLists.txt93
-rw-r--r--src/CMakeLists.txt1
-rw-r--r--src/H5Omtime.c12
-rw-r--r--src/H5system.c33
-rw-r--r--src/H5win32defs.h6
5 files changed, 82 insertions, 63 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 33c8ddf..65124ab 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -535,53 +535,54 @@ if (NOT HDF5_EXTERNALLY_CONFIGURED)
endif (NOT HDF5_EXTERNALLY_CONFIGURED)
#-----------------------------------------------------------------------------
# Option to use threadsafe
-# Note: Currently CMake only allows configuring of threadsafe on
-# non-Cygwin WINDOWS.
#-----------------------------------------------------------------------------
-if (WIN32)
- option (HDF5_ENABLE_THREADSAFE "Enable thread-safety" OFF)
- if (HDF5_ENABLE_THREADSAFE)
- # check for unsupported options
- message (STATUS " **** thread-safety option not supported with static library **** ")
- message (STATUS " **** thread-safety option will not be used building static library **** ")
- if (HDF5_ENABLE_PARALLEL)
- if (NOT ALLOW_UNSUPPORTED)
- message (FATAL_ERROR " **** parallel and thread-safety options are not supported **** ")
- else (NOT ALLOW_UNSUPPORTED)
- message (STATUS " **** Allowing unsupported parallel and thread-safety options **** ")
- endif (NOT ALLOW_UNSUPPORTED)
- endif (HDF5_ENABLE_PARALLEL)
- if (HDF5_BUILD_FORTRAN)
- if (NOT ALLOW_UNSUPPORTED)
- message (FATAL_ERROR " **** Fortran and thread-safety options are not supported **** ")
- else (NOT ALLOW_UNSUPPORTED)
- message (STATUS " **** Allowing unsupported Fortran and thread-safety options **** ")
- endif (NOT ALLOW_UNSUPPORTED)
- endif (HDF5_BUILD_FORTRAN)
- if (HDF5_BUILD_CPP_LIB)
- if (NOT ALLOW_UNSUPPORTED)
- message (FATAL_ERROR " **** C++ and thread-safety options are not supported **** ")
- else (NOT ALLOW_UNSUPPORTED)
- message (STATUS " **** Allowing unsupported C++ and thread-safety options **** ")
- endif (NOT ALLOW_UNSUPPORTED)
- endif (HDF5_BUILD_CPP_LIB)
- if (HDF5_BUILD_HL_LIB)
- if (NOT ALLOW_UNSUPPORTED)
- message (FATAL_ERROR " **** HL and thread-safety options are not supported **** ")
- else (NOT ALLOW_UNSUPPORTED)
- message (STATUS " **** Allowing unsupported HL and thread-safety options **** ")
- endif (NOT ALLOW_UNSUPPORTED)
- endif (HDF5_BUILD_HL_LIB)
- if (H5_HAVE_IOEO)
- message (STATUS " **** Win32 threads requires WINVER>=0x600 (Windows Vista/7/8) **** ")
- set (H5_HAVE_WIN_THREADS 1)
- else (H5_HAVE_IOEO)
- if (NOT H5_HAVE_PTHREAD_H)
- message (FATAL_ERROR " **** thread-safe option requires Win32 threads or Pthreads **** ")
- endif (NOT H5_HAVE_PTHREAD_H)
- endif (H5_HAVE_IOEO)
- endif (HDF5_ENABLE_THREADSAFE)
-endif (WIN32)
+option (HDF5_ENABLE_THREADSAFE "Enable thread-safety" OFF)
+if (HDF5_ENABLE_THREADSAFE)
+ # check for unsupported options
+ message (STATUS " **** thread-safety option not supported with static library **** ")
+ message (STATUS " **** thread-safety option will not be used building static library **** ")
+ if (HDF5_ENABLE_PARALLEL)
+ if (NOT ALLOW_UNSUPPORTED)
+ message (FATAL_ERROR " **** parallel and thread-safety options are not supported **** ")
+ else (NOT ALLOW_UNSUPPORTED)
+ message (STATUS " **** Allowing unsupported parallel and thread-safety options **** ")
+ endif (NOT ALLOW_UNSUPPORTED)
+ endif (HDF5_ENABLE_PARALLEL)
+ if (HDF5_BUILD_FORTRAN)
+ if (NOT ALLOW_UNSUPPORTED)
+ message (FATAL_ERROR " **** Fortran and thread-safety options are not supported **** ")
+ else (NOT ALLOW_UNSUPPORTED)
+ message (STATUS " **** Allowing unsupported Fortran and thread-safety options **** ")
+ endif (NOT ALLOW_UNSUPPORTED)
+ endif (HDF5_BUILD_FORTRAN)
+ if (HDF5_BUILD_CPP_LIB)
+ if (NOT ALLOW_UNSUPPORTED)
+ message (FATAL_ERROR " **** C++ and thread-safety options are not supported **** ")
+ else (NOT ALLOW_UNSUPPORTED)
+ message (STATUS " **** Allowing unsupported C++ and thread-safety options **** ")
+ endif (NOT ALLOW_UNSUPPORTED)
+ endif (HDF5_BUILD_CPP_LIB)
+ if (HDF5_BUILD_HL_LIB)
+ if (NOT ALLOW_UNSUPPORTED)
+ message (FATAL_ERROR " **** HL and thread-safety options are not supported **** ")
+ else (NOT ALLOW_UNSUPPORTED)
+ message (STATUS " **** Allowing unsupported HL and thread-safety options **** ")
+ endif (NOT ALLOW_UNSUPPORTED)
+ endif (HDF5_BUILD_HL_LIB)
+ if (H5_HAVE_IOEO)
+ message (STATUS " **** Win32 threads requires WINVER>=0x600 (Windows Vista/7/8) **** ")
+ set (H5_HAVE_WIN_THREADS 1)
+ else (H5_HAVE_IOEO)
+ if (NOT H5_HAVE_PTHREAD_H)
+ message (FATAL_ERROR " **** thread-safe option requires Win32 threads or Pthreads **** ")
+ endif (NOT H5_HAVE_PTHREAD_H)
+ endif (H5_HAVE_IOEO)
+ set(THREADS_PREFER_PTHREAD_FLAG ON)
+ find_package(Threads)
+ if (NOT Threads_FOUND)
+ message (STATUS " **** thread-safe package not found - threads still might work **** ")
+ endif (NOT Threads_FOUND)
+endif (HDF5_ENABLE_THREADSAFE)
# -----------------------------------------------------------------------
# wrapper script variables
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 10c430f..a9d2c2e 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -901,6 +901,7 @@ if (BUILD_SHARED_LIBS)
APPEND PROPERTY COMPILE_DEFINITIONS
"H5_HAVE_THREADSAFE"
)
+ target_link_libraries (${HDF5_LIBSH_TARGET} Threads::Threads)
endif (HDF5_ENABLE_THREADSAFE)
if (HDF5_ENABLE_DEBUG_APIS)
diff --git a/src/H5Omtime.c b/src/H5Omtime.c
index 32248fa..d8c5305 100644
--- a/src/H5Omtime.c
+++ b/src/H5Omtime.c
@@ -186,12 +186,6 @@ H5O_mtime_decode(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5
int i;
struct tm tm;
void *ret_value = NULL; /* Return value */
-#if _MSC_VER >= 1900 // VS 2015
-// In gcc and in Visual Studio prior to VS 2015 'timezone' is a global
-// variable declared in time.h. That variable was deprecated and in VS 2015
-// is removed, with _get_timezone replacing it.
- long timezone = 0;
-#endif
FUNC_ENTER_NOAPI_NOINIT
@@ -232,11 +226,7 @@ H5O_mtime_decode(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5
/* BSD-like systems */
the_time += tm.tm_gmtoff;
#elif defined(H5_HAVE_TIMEZONE)
- #if _MSC_VER >= 1900 // VS 2015
- HDget_timezone(&timezone);
- #endif
- /* GNU/Linux systems */
- the_time -= timezone - (tm.tm_isdst ? 3600 : 0);
+ the_time -= HDget_timezone() - (tm.tm_isdst ? 3600 : 0);
#else
/*
* The catch-all. If we can't convert a character string universal
diff --git a/src/H5system.c b/src/H5system.c
index 2653348..ff2a62b 100644
--- a/src/H5system.c
+++ b/src/H5system.c
@@ -648,6 +648,39 @@ Nflock(int fd, int operation) {
/*-------------------------------------------------------------------------
+ * Function: HDget_timezone
+ *
+ * Purpose: Wrapper function for global variable timezone, if it exists
+ * on this system, or use the function if VS2015
+ *
+ * VS2015 removed the deprecated global variable timezone.
+ *
+ * Return: Success: The value of timezone
+ *
+ * Failure: Cannot fail.
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifdef H5_HAVE_TIMEZONE
+
+long HDget_timezone(void)
+{
+#if _MSC_VER >= 1900 /* VS 2015 */
+
+ /* In gcc and in Visual Studio prior to VS 2015 'timezone' is a global
+ * variable declared in time.h. That variable was deprecated and in
+ * VS 2015 is removed, with _get_timezone replacing it.
+ */
+ long timezone = 0;
+
+ #define HDget_timezone(V) _get_timezone(V);
+ HDget_timezone(&timezone);
+#endif
+ return timezone;
+}
+#endif /* H5_HAVE_TIMEZONE */
+
+/*-------------------------------------------------------------------------
* Function: Wgettimeofday
*
* Purpose: Wrapper function for gettimeofday on Windows systems
diff --git a/src/H5win32defs.h b/src/H5win32defs.h
index 1a9b595..e84def9 100644
--- a/src/H5win32defs.h
+++ b/src/H5win32defs.h
@@ -86,12 +86,6 @@ struct timezone {
#define HDgetlogin() Wgetlogin()
#define HDsnprintf c99_snprintf /*varargs*/
#define HDvsnprintf c99_vsnprintf
-#if _MSC_VER >= 1900 // VS 2015
- // In gcc and in Visual Studio prior to VS 2015 'timezone' is a global
- // variable declared in time.h. That variable was deprecated and in VS 2015
- // is removed, with _get_timezone replacing it.
- #define HDget_timezone(V) _get_timezone(V);
-#endif
#endif /* H5_HAVE_VISUAL_STUDIO */