浏览代码

configure.ac: check timespec before pthread_create and have starpu definition for unistd.h

Nathalie Furmento 9 年之前
父节点
当前提交
c65c3d4769
共有 1 个文件被更改,包括 13 次插入13 次删除
  1. 13 13
      configure.ac

+ 13 - 13
configure.ac

@@ -189,6 +189,18 @@ case "${srcdir}" in
      AC_SUBST(STARPU_SRC_DIR, "$(eval echo $PWD/${srcdir})") ;;
 esac
 
+AC_CHECK_TYPE([struct timespec], 
+	       AC_DEFINE(STARPU_HAVE_STRUCT_TIMESPEC,[],[struct timespec is defined]),
+	       [], [
+#include <sys/types.h>
+#include <sys/stat.h>
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#include <time.h>
+])
+
+AC_CHECK_HEADERS([unistd.h], [AC_DEFINE([STARPU_HAVE_UNISTD_H], [1], [Define to 1 if you have the <unistd.h> header file.])])
 
 case "$target" in
 *-*-mingw*|*-*-cygwin*)
@@ -202,6 +214,7 @@ then
     CPPFLAGS+=" -I$STARPU_SRC_DIR/include/pthread_win32 "
     AC_COMPILE_IFELSE(
           [AC_LANG_PROGRAM([[
+	        #define STARPU_CONFIGURE
 		#include <pthread.h>
 		]],
 		[[ pthread_t t; pthread_create(&t, NULL, NULL, NULL); ]])],
@@ -210,19 +223,6 @@ then
 else
     AC_CHECK_LIB([pthread], [pthread_create])
 fi
-AC_CHECK_TYPE([struct timespec], 
-	       AC_DEFINE(STARPU_HAVE_STRUCT_TIMESPEC,[],[struct timespec is defined]),
-	       [], [
-#include <sys/types.h>
-#include <sys/stat.h>
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#include <time.h>
-#ifndef STARPU_NATIVE_WINTHREADS
-#include <pthread.h>
-#endif
-])
 
 AC_SEARCH_LIBS([sqrt],[m],,AC_MSG_ERROR([math library unavailable]))
 AC_HAVE_LIBRARY([ws2_32])