Преглед на файлове

backport r14516 from 1.1: detect whether struct timespec is defined by mingw at configure time instead of guessing guard macros

Samuel Thibault преди 10 години
родител
ревизия
b527c986e5
променени са 2 файла, в които са добавени 6 реда и са изтрити 2 реда
  1. 3 0
      configure.ac
  2. 3 2
      include/pthread_win32/pthread.h

+ 3 - 0
configure.ac

@@ -207,6 +207,9 @@ then
 else
     AC_CHECK_LIB([pthread], [pthread_create])
 fi
+AC_CHECK_TYPES([struct timespec], 
+	       AC_DEFINE(STARPU_HAVE_STRUCT_TIMESPEC,[],[struct timespec is defined by time.h]),
+	       [], [#include <time.h>])
 
 AC_SEARCH_LIBS([sqrt],[m],,AC_MSG_ERROR([math library unavailable]))
 AC_HAVE_LIBRARY([ws2_32])

+ 3 - 2
include/pthread_win32/pthread.h

@@ -33,6 +33,7 @@ extern "C" {
 
 #include <windows.h>
 #include <sys/types.h>
+#include <time.h>
 #include <stdio.h>
 #include <errno.h>
 
@@ -269,7 +270,7 @@ typedef struct {
 } pthread_cond_t;
 #define PTHREAD_COND_INITIALIZER { NULL, 0}
 
-#ifndef _TIMESPEC_DEFINED
+#ifndef STARPU_HAVE_STRUCT_TIMESPEC
 #ifndef STARPU_TIMESPEC_DEFINED
 #define STARPU_TIMESPEC_DEFINED 1
 struct timespec {
@@ -277,7 +278,7 @@ struct timespec {
   long    tv_nsec; /* Nanoseconds */
 };
 #endif /* STARPU_TIMESPEC_DEFINED */
-#endif
+#endif /* STARPU_HAVE_STRUCT_TIMESPEC */
 
 typedef unsigned pthread_condattr_t;