diff options
author | Daniel Drake <dsd@gentoo.org> | 2009-10-28 20:33:49 +0545 |
---|---|---|
committer | Daniel Drake <dsd@gentoo.org> | 2009-11-07 10:46:09 +0000 |
commit | 4783008b7e711de9cb31631e60dda995f44068de (patch) | |
tree | 41eb729442f7df6da2ef58469b8dc7cd43e6d326 /configure.ac | |
parent | 9b120c2b3735566533c179aa8ca758fe45899a38 (diff) | |
download | libusb-4783008b7e711de9cb31631e60dda995f44068de.tar.gz |
Use timerfd for timeout handling
Use a new file descriptor from the timerfd system calls to handle
timeouts. On supported systems, this means that there is less hassle
figuring out when the poll() timeout should be, since
libusb_get_next_timeout() will always return 0 and the timeout events will
be triggered as regular activity on the file descriptor set.
Add API function libusb_pollfds_handle_timeouts() to detect whether
you're on a platform with the timing headache, and flesh out the
surrounding documentation.
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac index d287e01..ba6014e 100644 --- a/configure.ac +++ b/configure.ac @@ -45,6 +45,30 @@ AC_SUBST(lt_major) AC_SUBST(lt_revision) AC_SUBST(lt_age) +# timerfd +AC_CHECK_HEADER([sys/timerfd.h], [timerfd_h=1], [timerfd_h=0]) +AC_ARG_ENABLE([timerfd], + [AS_HELP_STRING([--enable-timerfd], + [use timerfd for timing (default auto)])], + [use_timerfd=$enableval], [use_timerfd='auto']) + +if test "x$use_timerfd" = "xyes" -a "x$timerfd_h" = "x0"; then + AC_MSG_ERROR([timerfd header not available; glibc 2.8+ required]) +error +fi + +AC_MSG_CHECKING([whether to use timerfd for timing]) +if test "x$use_timerfd" = "xno"; then + AC_MSG_RESULT([no (disabled by user)]) +else + if test "x$timerfd_h" = "x1"; then + AC_MSG_RESULT([yes]) + AC_DEFINE(USBI_TIMERFD_AVAILABLE, [], [timerfd headers available]) + else + AC_MSG_RESULT([no (header not available)]) + fi +fi + # Message logging AC_ARG_ENABLE([log], [AS_HELP_STRING([--disable-log], [disable all logging])], [log_enabled=$enableval], |