1 # Check for support for nanosleep. It's defined in <time.h>, but on
2 # some systems, such as solaris, you need to link in a library to use it.
3 # We set acx_nanosleep_ok if nanosleep is supported; in that case,
4 # NANOSLEEP_LIBS is set to whatever libraries are needed to support
7 AC_DEFUN([ACX_NANOSLEEP],
8 [AC_MSG_CHECKING(if nanosleep requires any libraries)
13 # For most folks, this should just work
14 AC_TRY_LINK([#include <time.h>],
15 [static struct timespec ts; nanosleep(&ts, NULL);],
16 [acx_nanosleep_ok=yes])
17 # For solaris, we may need -lrt
18 if test "x$acx_nanosleep_ok" != "xyes"; then
21 AC_TRY_LINK([#include <time.h>],
22 [static struct timespec ts; nanosleep(&ts, NULL);],
23 [acx_nanosleep_ok=yes])
24 if test "x$acx_nanosleep_ok" = "xyes"; then
29 if test "x$acx_nanosleep_ok" != "xyes"; then
30 AC_MSG_ERROR([cannot find the nanosleep function])
32 AC_MSG_RESULT(${NANOSLEEP_LIBS:-no})