Merge from emacs-24; up to 2013-01-03T01:56:56Z!rgm@gnu.org
[bpt/emacs.git] / m4 / timer_time.m4
CommitLineData
a615a3ae 1# timer_time.m4 serial 2
ab422c4d 2dnl Copyright (C) 2011-2013 Free Software Foundation, Inc.
a615a3ae
PE
3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved.
6
7# Check for timer_settime, and set LIB_TIMER_TIME.
8
9AC_DEFUN([gl_TIMER_TIME],
10[
11 dnl Based on clock_time.m4. See details there.
12
13 AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
14 AC_REQUIRE([gl_THREADLIB])
15
16 LIB_TIMER_TIME=
17 AC_SUBST([LIB_TIMER_TIME])
18 gl_saved_libs=$LIBS
19 AC_SEARCH_LIBS([timer_settime], [rt posix4],
20 [test "$ac_cv_search_timer_settime" = "none required" ||
21 LIB_TIMER_TIME=$ac_cv_search_timer_settime])
22 dnl GLIBC uses threads to emulate posix timers when kernel support
23 dnl is not available (like Linux < 2.6 or when used with kFreeBSD)
24 dnl Now the pthread lib is linked automatically in the normal case,
25 dnl but when linking statically, it needs to be explicitly specified.
26 AC_EGREP_CPP([Thread],
27 [
28#include <features.h>
29#ifdef __GNU_LIBRARY__
30 #if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2) || (__GLIBC__ > 2)) \
31 && !defined __UCLIBC__
32 Thread emulation available
33 #endif
34#endif
35 ],
36 [LIB_TIMER_TIME="$LIB_TIMER_TIME $LIBMULTITHREAD"])
37 AC_CHECK_FUNCS([timer_settime])
38 LIBS=$gl_saved_libs
39])