diff --git a/urjtag/ChangeLog b/urjtag/ChangeLog index 3421db85..05774c50 100644 --- a/urjtag/ChangeLog +++ b/urjtag/ChangeLog @@ -1,3 +1,9 @@ +2010-08-18 Mike Frysinger + + * configure.ac (AC_CHECK_FUNCS): Check for _sleep. + * src/lib/usleep.c: Support a fuzzy version of usleep based on old mingw + _sleep functions. + 2010-08-16 Mike Frysinger * src/tap/detect.c (urj_tap_detect_parts): Include paths to data files when diff --git a/urjtag/configure.ac b/urjtag/configure.ac index 8ed64cc4..4db4a98f 100644 --- a/urjtag/configure.ac +++ b/urjtag/configure.ac @@ -116,6 +116,7 @@ else fi AC_CHECK_FUNCS(m4_flatten([ + _sleep geteuid getuid nanosleep diff --git a/urjtag/src/lib/usleep.c b/urjtag/src/lib/usleep.c index 05a2c567..6b4d4d50 100644 --- a/urjtag/src/lib/usleep.c +++ b/urjtag/src/lib/usleep.c @@ -23,9 +23,7 @@ #ifndef HAVE_USLEEP -#ifndef HAVE_NANOSLEEP -# error Need usleep or nanosleep -#endif +#ifdef HAVE_NANOSLEEP #include @@ -42,4 +40,17 @@ int usleep (long unsigned usec) return nanosleep (&req, NULL); } +#elif defined(HAVE__SLEEP) + +/* Not exact, but close enough */ +int usleep (long unsigned usec) +{ + _sleep (usec / 1000); + return 0; +} + +#else +# error "Need sleep, usleep, or nanosleep" +#endif + #endif