* lib/nanosleep.c [HAVE_SYS_SELECT_H]: Include <sys/select.h>.
Use the usual Autoconf way to include <time.h> and/or sys/time.h.
(my_usleep): Don't mishandle maximum value.
* m4/nanosleep.m4 (gl_FUNC_NANOSLEEP): Rename cache variables to use
gl_ rather than jm_. Link, don't run, so that cross-compiles are
allowed. Check that resulting type is arithmetic. Move AC_REQUIRE
and AC_CHECK_HEADERS_ONCE outside of AC_CACHE_CHECK, since they're
not really conditional on the cache.
(gl_PREREQ_NANOSLEEP): Check for sys/select.h.