projects
/
gnulib.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Make it possible to use a locally augmented gnulib.
[gnulib.git]
/
m4
/
nanosleep.m4
diff --git
a/m4/nanosleep.m4
b/m4/nanosleep.m4
index
2d6c90b
..
56c66bb
100644
(file)
--- a/
m4/nanosleep.m4
+++ b/
m4/nanosleep.m4
@@
-1,11
+1,13
@@
-#serial 1
4
+#serial 1
7
dnl From Jim Meyering.
dnl Check for the nanosleep function.
dnl If not found, use the supplied replacement.
dnl
dnl From Jim Meyering.
dnl Check for the nanosleep function.
dnl If not found, use the supplied replacement.
dnl
-# Copyright (C) 1999, 2000, 2001, 2003, 2004, 2005 Free Software Foundation, Inc.
+# Copyright (C) 1999, 2000, 2001, 2003, 2004, 2005, 2006 Free Software
+# Foundation, Inc.
+
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@
-14,6
+16,12
@@
AC_DEFUN([gl_FUNC_NANOSLEEP],
[
AC_LIBSOURCES([nanosleep.c])
[
AC_LIBSOURCES([nanosleep.c])
+ dnl Persuade glibc and Solaris <time.h> to declare nanosleep.
+ AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+
+ AC_REQUIRE([AC_HEADER_TIME])
+ AC_CHECK_HEADERS_ONCE(sys/time.h)
+
nanosleep_save_libs=$LIBS
# Solaris 2.5.1 needs -lposix4 to get the nanosleep function.
nanosleep_save_libs=$LIBS
# Solaris 2.5.1 needs -lposix4 to get the nanosleep function.
@@
-23,12
+31,10
@@
AC_DEFUN([gl_FUNC_NANOSLEEP],
LIB_NANOSLEEP=$ac_cv_search_nanosleep])
AC_SUBST([LIB_NANOSLEEP])
LIB_NANOSLEEP=$ac_cv_search_nanosleep])
AC_SUBST([LIB_NANOSLEEP])
- AC_CACHE_CHECK([
whether nanosleep works
],
-
jm_cv_func_nanosleep_works
,
+ AC_CACHE_CHECK([
for nanosleep
],
+
[gl_cv_func_nanosleep]
,
[
[
- AC_REQUIRE([AC_HEADER_TIME])
- AC_CHECK_HEADERS_ONCE(sys/time.h)
- AC_TRY_RUN([
+ AC_LINK_IFELSE([AC_LANG_SOURCE([[
# if TIME_WITH_SYS_TIME
# include <sys/time.h>
# include <time.h>
# if TIME_WITH_SYS_TIME
# include <sys/time.h>
# include <time.h>
@@
-46,15
+52,13
@@
AC_DEFUN([gl_FUNC_NANOSLEEP],
struct timespec ts_sleep, ts_remaining;
ts_sleep.tv_sec = 0;
ts_sleep.tv_nsec = 1;
struct timespec ts_sleep, ts_remaining;
ts_sleep.tv_sec = 0;
ts_sleep.tv_nsec = 1;
-
exit (nanosleep (&ts_sleep, &ts_remaining) == 0 ? 0 : 1)
;
+
return nanosleep (&ts_sleep, &ts_remaining) < 0
;
}
}
- ],
- jm_cv_func_nanosleep_works=yes,
- jm_cv_func_nanosleep_works=no,
- dnl When crosscompiling, assume the worst.
- jm_cv_func_nanosleep_works=no)
+ ]])],
+ [gl_cv_func_nanosleep=yes],
+ [gl_cv_func_nanosleep=no])
])
])
- if test $
jm_cv_func_nanosleep_works
= no; then
+ if test $
gl_cv_func_nanosleep
= no; then
AC_LIBOBJ(nanosleep)
AC_DEFINE(nanosleep, rpl_nanosleep,
[Define to rpl_nanosleep if the replacement function should be used.])
AC_LIBOBJ(nanosleep)
AC_DEFINE(nanosleep, rpl_nanosleep,
[Define to rpl_nanosleep if the replacement function should be used.])
@@
-68,4
+72,5
@@
AC_DEFUN([gl_FUNC_NANOSLEEP],
AC_DEFUN([gl_PREREQ_NANOSLEEP],
[
AC_CHECK_FUNCS_ONCE(siginterrupt)
AC_DEFUN([gl_PREREQ_NANOSLEEP],
[
AC_CHECK_FUNCS_ONCE(siginterrupt)
+ AC_CHECK_HEADERS_ONCE(sys/select.h)
])
])