3 # Define HAVE_TIME_H to 1 if <time.h> is available.
4 AC_DEFUN([HW_HEADER_TIME_H],
6 AC_PREREQ([2.60])dnl Older releases should work if AC_CHECK_HEADERS is used.
7 AC_CHECK_HEADERS_ONCE([time.h])
12 # Set $hw_cv_librt_timers and $hw_cv_librt_timers_posix to "yes" or "no",
13 # respectively. If the timer_create() function is available and
14 # POSIX compliant, then the system's timer_create(), timer_settime(),
15 # and timer_delete() functions are used. Otherwise, make sure
16 # the replacement functions will be built.
18 # In the case where we are cross compiling, the POSIX detection of
19 # the timer_create() function is skipped, and instead the usual check
20 # for the existence of all the timer_* functions is done using
23 # If enable_timer_replacement=true, the replacements is forced to be built.
24 AC_DEFUN([HW_LIBRT_TIMERS],
26 AC_PREREQ([2.60])dnl 2.59 should work if some AC_TYPE_* macros are replaced.
27 AC_REQUIRE([HW_HEADER_TIME_H])dnl Our check evaluates HAVE_TIME_H.
29 if test "xtrue" != x"$enable_timer_replacement"; then
30 AC_CHECK_FUNC([timer_create],
31 [hw_cv_librt_timers=yes],
32 [hw_cv_librt_timers=no])
33 AS_IF([test "$hw_cv_librt_timers" = yes],
34 [AC_CACHE_CHECK([if timer_create is supported on the system],
35 [hw_cv_librt_timers_posix],
42 static int test_timer_create()
45 if(timer_create(CLOCK_REALTIME, NULL, &timerid) != 0)
48 On this system, although the function is available,
49 no meaningful implementation is provided.
58 [[return test_timer_create();]])],
59 [hw_cv_librt_timers_posix=yes],
60 [hw_cv_librt_timers_posix=no],
61 [hw_cv_librt_timers_posix=autodetect])])],
62 [hw_cv_librt_timers_posix=no])
64 hw_cv_librt_timers_posix=no
67 # If the system does not have a POSIX timer_create(), then use
68 # Check's reimplementation of the timer_* calls
69 AS_IF([test "$hw_cv_librt_timers_posix" = no],
70 [_HW_LIBRT_TIMERS_REPLACE])
72 # If we are cross compiling, do the normal check for the
74 AS_IF([test "$hw_cv_librt_timers_posix" = autodetect],
75 [AC_REPLACE_FUNCS([timer_create timer_settime timer_delete])
76 AC_CHECK_DECLS([timer_create, timer_settime, timer_delete])])
79 # _HW_LIBRT_TIMERS_REPLACE
80 # ------------------------
81 # Arrange for building timer_create.c, timer_settime.c, and
83 AC_DEFUN([_HW_LIBRT_TIMERS_REPLACE],
85 AS_IF([test "x$_hw_cv_librt_timers_replace_done" != xyes],
86 [AC_LIBOBJ([timer_create])
87 AC_LIBOBJ([timer_settime])
88 AC_LIBOBJ([timer_delete])
89 _hw_cv_librt_timers_replace_done=yes])
90 ])# _HW_LIBRT_TIMERS_REPLACE