declare smobs in alloc.c
[bpt/emacs.git] / m4 / timer_time.m4
1 # timer_time.m4 serial 3
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.
6
7 # Check for timer_settime, and set LIB_TIMER_TIME.
8
9 AC_DEFUN([gl_TIMER_TIME],
10 [
11 dnl Based on clock_time.m4. See details there.
12
13 AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
14
15 dnl Test whether the gnulib module 'threadlib' is in use.
16 dnl Some packages like Emacs use --avoid=threadlib.
17 dnl Write the symbol in such a way that it does not cause 'aclocal' to pick
18 dnl the threadlib.m4 file that is installed in $PREFIX/share/aclocal/.
19 m4_ifdef([gl_][THREADLIB], [AC_REQUIRE([gl_][THREADLIB])])
20
21 LIB_TIMER_TIME=
22 AC_SUBST([LIB_TIMER_TIME])
23 gl_saved_libs=$LIBS
24 AC_SEARCH_LIBS([timer_settime], [rt posix4],
25 [test "$ac_cv_search_timer_settime" = "none required" ||
26 LIB_TIMER_TIME=$ac_cv_search_timer_settime])
27 m4_ifdef([gl_][THREADLIB],
28 [dnl GLIBC uses threads to emulate posix timers when kernel support
29 dnl is not available (like Linux < 2.6 or when used with kFreeBSD)
30 dnl Now the pthread lib is linked automatically in the normal case,
31 dnl but when linking statically, it needs to be explicitly specified.
32 AC_EGREP_CPP([Thread],
33 [#include <features.h>
34 #ifdef __GNU_LIBRARY__
35 #if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2) || (__GLIBC__ > 2)) \
36 && !(__UCLIBC__ && __HAS_NO_THREADS__)
37 Thread emulation available
38 #endif
39 #endif
40 ],
41 [LIB_TIMER_TIME="$LIB_TIMER_TIME $LIBMULTITHREAD"])])
42 AC_CHECK_FUNCS([timer_settime])
43 LIBS=$gl_saved_libs
44 ])