1 # timer_time.m4 serial 2
2 dnl Copyright (C) 2011-2015 Free Software Foundation, Inc.
3 dnl This file is free software; the Free Software Foundation
4 dnl gives unlimited permission to copy and/or distribute it,
5 dnl with or without modifications, as long as this notice is preserved.
7 # Check for timer_settime, and set LIB_TIMER_TIME.
9 AC_DEFUN([gl_TIMER_TIME],
11 dnl Based on clock_time.m4. See details there.
13 AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
14 AC_REQUIRE([gl_THREADLIB])
17 AC_SUBST([LIB_TIMER_TIME])
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],
29 #ifdef __GNU_LIBRARY__
30 #if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2) || (__GLIBC__ > 2)) \
31 && !(__UCLIBC__ && __HAS_NO_THREADS__)
32 Thread emulation available
36 [LIB_TIMER_TIME="$LIB_TIMER_TIME $LIBMULTITHREAD"])
37 AC_CHECK_FUNCS([timer_settime])