summaryrefslogtreecommitdiff
path: root/src/third_party/gperftools-2.7/dist/m4/acx_nanosleep.m4
diff options
context:
space:
mode:
Diffstat (limited to 'src/third_party/gperftools-2.7/dist/m4/acx_nanosleep.m4')
-rw-r--r--src/third_party/gperftools-2.7/dist/m4/acx_nanosleep.m435
1 files changed, 35 insertions, 0 deletions
diff --git a/src/third_party/gperftools-2.7/dist/m4/acx_nanosleep.m4 b/src/third_party/gperftools-2.7/dist/m4/acx_nanosleep.m4
new file mode 100644
index 00000000000..1d443926fa2
--- /dev/null
+++ b/src/third_party/gperftools-2.7/dist/m4/acx_nanosleep.m4
@@ -0,0 +1,35 @@
+# Check for support for nanosleep. It's defined in <time.h>, but on
+# some systems, such as solaris, you need to link in a library to use it.
+# We set acx_nanosleep_ok if nanosleep is supported; in that case,
+# NANOSLEEP_LIBS is set to whatever libraries are needed to support
+# nanosleep.
+
+AC_DEFUN([ACX_NANOSLEEP],
+[AC_MSG_CHECKING(if nanosleep requires any libraries)
+ AC_LANG_SAVE
+ AC_LANG_C
+ acx_nanosleep_ok="no"
+ NANOSLEEP_LIBS=
+ # For most folks, this should just work
+ AC_TRY_LINK([#include <time.h>],
+ [static struct timespec ts; nanosleep(&ts, NULL);],
+ [acx_nanosleep_ok=yes])
+ # For solaris, we may need -lrt
+ if test "x$acx_nanosleep_ok" != "xyes"; then
+ OLD_LIBS="$LIBS"
+ LIBS="-lrt $LIBS"
+ AC_TRY_LINK([#include <time.h>],
+ [static struct timespec ts; nanosleep(&ts, NULL);],
+ [acx_nanosleep_ok=yes])
+ if test "x$acx_nanosleep_ok" = "xyes"; then
+ NANOSLEEP_LIBS="-lrt"
+ fi
+ LIBS="$OLD_LIBS"
+ fi
+ if test "x$acx_nanosleep_ok" != "xyes"; then
+ AC_MSG_ERROR([cannot find the nanosleep function])
+ else
+ AC_MSG_RESULT(${NANOSLEEP_LIBS:-no})
+ fi
+ AC_LANG_RESTORE
+])