Update copyright year to 2014 by running admin/update-copyright.
[emacs.git] / m4 / timer_time.m4
blob6eceadd59a389f82da64772338869ca550473890
1 # timer_time.m4 serial 2
2 dnl Copyright (C) 2011-2014 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])
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