summaryrefslogtreecommitdiff
path: root/gnulib-m4/nanosleep.m4
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff.email>2022-10-24 22:25:29 +0200
committerJörg Frings-Fürst <debian@jff.email>2022-10-24 22:25:29 +0200
commit26112352a774737e1ce5580c93654a26c1e82b39 (patch)
treed64e2f5b6e7aa92fa9a8ffb8ae5df75310532714 /gnulib-m4/nanosleep.m4
parentbe8efac78d067c138ad8dda03df4336e73f94887 (diff)
New upstream version 1.1upstream/1.1
Diffstat (limited to 'gnulib-m4/nanosleep.m4')
-rw-r--r--gnulib-m4/nanosleep.m439
1 files changed, 12 insertions, 27 deletions
diff --git a/gnulib-m4/nanosleep.m4 b/gnulib-m4/nanosleep.m4
index 6a51f28e..dfe21f56 100644
--- a/gnulib-m4/nanosleep.m4
+++ b/gnulib-m4/nanosleep.m4
@@ -1,4 +1,4 @@
-# serial 40
+# serial 42
dnl From Jim Meyering.
dnl Check for the nanosleep function.
@@ -19,9 +19,6 @@ AC_DEFUN([gl_FUNC_NANOSLEEP],
dnl Persuade glibc and Solaris <time.h> to declare nanosleep.
AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
- AC_CHECK_HEADERS_ONCE([sys/time.h])
- AC_REQUIRE([gl_FUNC_SELECT])
-
AC_CHECK_DECLS_ONCE([alarm])
nanosleep_save_libs=$LIBS
@@ -53,9 +50,6 @@ AC_DEFUN([gl_FUNC_NANOSLEEP],
#include <errno.h>
#include <limits.h>
#include <signal.h>
- #if HAVE_SYS_TIME_H
- #include <sys/time.h>
- #endif
#include <time.h>
#include <unistd.h>
#define TYPE_SIGNED(t) (! ((t) 0 < (t) -1))
@@ -106,15 +100,22 @@ AC_DEFUN([gl_FUNC_NANOSLEEP],
#else /* A simpler test for native Windows. */
if (nanosleep (&ts_sleep, &ts_remaining) < 0)
return 3;
+ /* Test for 32-bit mingw bug: negative nanosecond values do not
+ cause failure. */
+ ts_sleep.tv_sec = 1;
+ ts_sleep.tv_nsec = -1;
+ if (nanosleep (&ts_sleep, &ts_remaining) != -1)
+ return 7;
#endif
return 0;
}]])],
[gl_cv_func_nanosleep=yes],
- [case $? in dnl (
- 4|5|6) gl_cv_func_nanosleep='no (mishandles large arguments)';; dnl (
- *) gl_cv_func_nanosleep=no;;
+ [case $? in
+ 4|5|6) gl_cv_func_nanosleep='no (mishandles large arguments)' ;;
+ 7) gl_cv_func_nanosleep='no (mishandles negative tv_nsec)' ;;
+ *) gl_cv_func_nanosleep=no ;;
esac],
- [case "$host_os" in dnl ((
+ [case "$host_os" in
linux*) # Guess it halfway works when the kernel is Linux.
gl_cv_func_nanosleep='guessing no (mishandles large arguments)' ;;
mingw*) # Guess no on native Windows.
@@ -135,15 +136,6 @@ AC_DEFUN([gl_FUNC_NANOSLEEP],
AC_DEFINE([HAVE_BUG_BIG_NANOSLEEP], [1],
[Define to 1 if nanosleep mishandles large arguments.])
;;
- *)
- # The replacement uses select(). Add $LIBSOCKET to $LIB_NANOSLEEP.
- for ac_lib in $LIBSOCKET; do
- case " $LIB_NANOSLEEP " in
- *" $ac_lib "*) ;;
- *) LIB_NANOSLEEP="$LIB_NANOSLEEP $ac_lib";;
- esac
- done
- ;;
esac
;;
esac
@@ -152,10 +144,3 @@ AC_DEFUN([gl_FUNC_NANOSLEEP],
fi
LIBS=$nanosleep_save_libs
])
-
-# Prerequisites of lib/nanosleep.c.
-AC_DEFUN([gl_PREREQ_NANOSLEEP],
-[
- AC_CHECK_HEADERS_ONCE([sys/select.h])
- gl_PREREQ_SIG_HANDLER_H
-])