Browse Source

configure: Explicitly check for sleep

Luke Dashjr 12 years ago
parent
commit
cd61807c9d
2 changed files with 5 additions and 1 deletions
  1. 3 1
      compat.h
  2. 2 0
      configure.ac

+ 3 - 1
compat.h

@@ -112,7 +112,7 @@ static inline int nanosleep(const struct timespec *req, struct timespec *rem)
 }
 }
 #endif
 #endif
 
 
-#ifdef WIN32
+#ifndef HAVE_SLEEP
 static inline int sleep(unsigned int secs)
 static inline int sleep(unsigned int secs)
 {
 {
 	struct timespec req, rem;
 	struct timespec req, rem;
@@ -122,7 +122,9 @@ static inline int sleep(unsigned int secs)
 		return 0;
 		return 0;
 	return rem.tv_sec + (rem.tv_nsec ? 1 : 0);
 	return rem.tv_sec + (rem.tv_nsec ? 1 : 0);
 }
 }
+#endif
 
 
+#ifdef WIN32
 enum {
 enum {
 	PRIO_PROCESS		= 0,
 	PRIO_PROCESS		= 0,
 };
 };

+ 2 - 0
configure.ac

@@ -60,6 +60,8 @@ AC_CHECK_HEADERS(syslog.h)
 AC_CHECK_HEADERS([sys/epoll.h])
 AC_CHECK_HEADERS([sys/epoll.h])
 AC_CHECK_HEADERS([sys/prctl.h])
 AC_CHECK_HEADERS([sys/prctl.h])
 
 
+AC_CHECK_FUNCS([sleep])
+
 AC_FUNC_ALLOCA
 AC_FUNC_ALLOCA
 
 
 have_cygwin=false
 have_cygwin=false