projects
/
gnulib.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
* modules/error (Depends-on): Remove gettext.
[gnulib.git]
/
m4
/
nanosleep.m4
diff --git
a/m4/nanosleep.m4
b/m4/nanosleep.m4
index
c73a3ff
..
0cf4094
100644
(file)
--- a/
m4/nanosleep.m4
+++ b/
m4/nanosleep.m4
@@
-1,19
+1,37
@@
-#serial
2
+#serial
10
dnl From Jim Meyering.
dnl From Jim Meyering.
-dnl Check for the nanosleep function
+dnl Check for the nanosleep function.
+dnl If not found, use the supplied replacement.
dnl
dnl
-AC_DEFUN(
jm_FUNC_NANOSLEEP
,
+AC_DEFUN(
[gl_FUNC_NANOSLEEP]
,
[
[
+ nanosleep_save_libs=$LIBS
+
# Solaris 2.5.1 needs -lposix4 to get the nanosleep function.
# Solaris 7 prefers the library name -lrt to the obsolescent name -lposix4.
# Solaris 2.5.1 needs -lposix4 to get the nanosleep function.
# Solaris 7 prefers the library name -lrt to the obsolescent name -lposix4.
- AC_SEARCH_LIBS(nanosleep, [rt posix4])
+ AC_SEARCH_LIBS([nanosleep], [rt posix4],
+ [test "$ac_cv_search_nanosleep" = "none required" ||
+ LIB_NANOSLEEP=$ac_cv_search_nanosleep])
+ AC_SUBST([LIB_NANOSLEEP])
AC_CACHE_CHECK([whether nanosleep works],
jm_cv_func_nanosleep_works,
AC_CACHE_CHECK([whether nanosleep works],
jm_cv_func_nanosleep_works,
- [AC_TRY_RUN([
-# include <time.h>
+ [
+ AC_REQUIRE([AC_HEADER_TIME])
+ AC_CHECK_HEADERS_ONCE(sys/time.h)
+ AC_TRY_RUN([
+# if TIME_WITH_SYS_TIME
+# include <sys/time.h>
+# include <time.h>
+# else
+# if HAVE_SYS_TIME_H
+# include <sys/time.h>
+# else
+# include <time.h>
+# endif
+# endif
int
main ()
int
main ()
@@
-27,12
+45,20
@@
AC_DEFUN(jm_FUNC_NANOSLEEP,
jm_cv_func_nanosleep_works=yes,
jm_cv_func_nanosleep_works=no,
dnl When crosscompiling, assume the worst.
jm_cv_func_nanosleep_works=yes,
jm_cv_func_nanosleep_works=no,
dnl When crosscompiling, assume the worst.
- jm_cv_func_nanosleep_works=
yes
)
+ jm_cv_func_nanosleep_works=
no
)
])
if test $jm_cv_func_nanosleep_works = no; then
])
if test $jm_cv_func_nanosleep_works = no; then
- AC_
SUBST(LIBOBJS
)
- LIBOBJS="$LIBOBJS nanosleep.$ac_objext"
- AC_DEFINE_UNQUOTED(nanosleep, gnu_nanosleep,
- [Define to gnu_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.])
+ gl_PREREQ_NANOSLEEP
fi
fi
+
+ LIBS=$nanosleep_save_libs
+])
+
+# Prerequisites of lib/nanosleep.c.
+AC_DEFUN([gl_PREREQ_NANOSLEEP],
+[
+ AC_CHECK_HEADERS_ONCE(unistd.h)
])
])