- add sources.
[platform/framework/web/crosswalk.git] / src / third_party / tcmalloc / vendor / m4 / acx_nanosleep.m4
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
5 # nanosleep.
6
7 AC_DEFUN([ACX_NANOSLEEP],
8 [AC_MSG_CHECKING(if nanosleep requires any libraries)
9  AC_LANG_SAVE
10  AC_LANG_C
11  acx_nanosleep_ok="no"
12  NANOSLEEP_LIBS=
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
19    OLD_LIBS="$LIBS"
20    LIBS="-lrt $LIBS"
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
25      NANOSLEEP_LIBS="-lrt"
26    fi
27    LIBS="$OLD_LIBS"
28  fi
29  if test "x$acx_nanosleep_ok" != "xyes"; then
30    AC_MSG_ERROR([cannot find the nanosleep function])
31  else
32    AC_MSG_RESULT(${NANOSLEEP_LIBS:-no})
33  fi
34  AC_LANG_RESTORE
35 ])