4 dnl Check for the nanosleep function.
5 dnl If not found, use the supplied replacement.
8 AC_DEFUN(jm_FUNC_NANOSLEEP,
10 # Solaris 2.5.1 needs -lposix4 to get the nanosleep function.
11 # Solaris 7 prefers the library name -lrt to the obsolescent name -lposix4.
12 AC_SEARCH_LIBS(nanosleep, [rt posix4])
14 AC_CACHE_CHECK([whether nanosleep works],
15 jm_cv_func_nanosleep_works,
22 struct timespec ts_sleep, ts_remaining;
25 exit (nanosleep (&ts_sleep, &ts_remaining) == 0 ? 0 : 1);
28 jm_cv_func_nanosleep_works=yes,
29 jm_cv_func_nanosleep_works=no,
30 dnl When crosscompiling, assume the worst.
31 jm_cv_func_nanosleep_works=yes)
33 if test $jm_cv_func_nanosleep_works = no; then
35 LIBOBJS="$LIBOBJS nanosleep.$ac_objext"
36 AC_DEFINE_UNQUOTED(nanosleep, gnu_nanosleep,
37 [Define to gnu_nanosleep if the replacement function should be used.])