Refine timerfd header check (#18)
authorDaniel Drake <dan@reactivated.net>
Sat, 21 Nov 2009 16:57:25 +0000 (16:57 +0000)
committerDaniel Drake <dan@reactivated.net>
Sat, 21 Nov 2009 16:58:31 +0000 (16:58 +0000)
Require glibc-2.9 for the working timerfd support.

configure.ac
libusb/io.c

index 180c14d..8aedfba 100644 (file)
@@ -53,15 +53,19 @@ AC_ARG_ENABLE([timerfd],
        [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
+       AC_MSG_ERROR([timerfd header not available; glibc 2.9+ required])
+fi
+
+AC_CHECK_DECL([TFD_NONBLOCK], [tfd_hdr_ok=yes], [tfd_hdr_ok=no], [#include <sys/timerfd.h>])
+if test "x$use_timerfd" = "xyes" -a "x$tfd_hdr_ok" = "xno"; then
+       AC_MSG_ERROR([timerfd header not usable; glibc 2.9+ required])
 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
+       if test "x$timerfd_h" = "x1" -a "x$tfd_hdr_ok" = "xyes"; then
                AC_MSG_RESULT([yes])
                AC_DEFINE(USBI_TIMERFD_AVAILABLE, [], [timerfd headers available])
        else
index 65c2cf4..f6a7e23 100644 (file)
@@ -632,7 +632,7 @@ while (user has not requested application exit) {
  *  - Darwin
  *  - Linux, provided that the following version requirements are satisfied:
  *   - Linux v2.6.27 or newer, compiled with timerfd support
- *   - glibc v2.8 or newer
+ *   - glibc v2.9 or newer
  *   - libusb v1.0.5 or newer
  *
  * Under these configurations, libusb_get_next_timeout() will \em always return