Browse Source

configure: Explicitly check for nanosleep

Luke Dashjr 12 years ago
parent
commit
e995bc55cc
2 changed files with 6 additions and 0 deletions
  1. 4 0
      compat.h
  2. 2 0
      configure.ac

+ 4 - 0
compat.h

@@ -76,7 +76,9 @@ struct tm *localtime_convert(time_t t)
 {
 {
 	return localtime(&t);
 	return localtime(&t);
 }
 }
+#endif
 
 
+#ifndef HAVE_NANOSLEEP
 static inline int nanosleep(const struct timespec *req, struct timespec *rem)
 static inline int nanosleep(const struct timespec *req, struct timespec *rem)
 {
 {
 	struct timeval tstart;
 	struct timeval tstart;
@@ -108,7 +110,9 @@ static inline int nanosleep(const struct timespec *req, struct timespec *rem)
 	}
 	}
 	return 0;
 	return 0;
 }
 }
+#endif
 
 
+#ifdef WIN32
 static inline int sleep(unsigned int secs)
 static inline int sleep(unsigned int secs)
 {
 {
 	struct timespec req, rem;
 	struct timespec req, rem;

+ 2 - 0
configure.ac

@@ -190,6 +190,8 @@ if test "x${found_pthread}" = "xfalse"; then
 		AC_MSG_ERROR([Could not find pthread library - please install libpthread])
 		AC_MSG_ERROR([Could not find pthread library - please install libpthread])
 	fi
 	fi
 fi
 fi
+# check for nanosleep here, since it is provided by winpthread
+AC_CHECK_FUNCS([nanosleep])
 CFLAGS="${save_CFLAGS}"
 CFLAGS="${save_CFLAGS}"
 LIBS="${save_LIBS}"
 LIBS="${save_LIBS}"