| 1 | #serial 11
|
|---|
| 2 |
|
|---|
| 3 | # Copyright (C) 2000, 2001, 2003, 2004, 2005 Free Software Foundation, Inc.
|
|---|
| 4 | # This file is free software; the Free Software Foundation
|
|---|
| 5 | # gives unlimited permission to copy and/or distribute it,
|
|---|
| 6 | # with or without modifications, as long as this notice is preserved.
|
|---|
| 7 |
|
|---|
| 8 | dnl From Jim Meyering
|
|---|
| 9 |
|
|---|
| 10 | AC_DEFUN([gl_TIMESPEC],
|
|---|
| 11 | [
|
|---|
| 12 | AC_LIBSOURCES([timespec.h])
|
|---|
| 13 |
|
|---|
| 14 | dnl Prerequisites of lib/timespec.h.
|
|---|
| 15 | AC_REQUIRE([AC_C_INLINE])
|
|---|
| 16 | AC_REQUIRE([AC_HEADER_TIME])
|
|---|
| 17 | AC_CHECK_HEADERS_ONCE(sys/time.h)
|
|---|
| 18 | gl_CHECK_TYPE_STRUCT_TIMESPEC
|
|---|
| 19 |
|
|---|
| 20 | dnl Persuade glibc <time.h> to declare nanosleep().
|
|---|
| 21 | AC_REQUIRE([AC_GNU_SOURCE])
|
|---|
| 22 |
|
|---|
| 23 | AC_CHECK_DECLS(nanosleep, , , [#include <time.h>])
|
|---|
| 24 | ])
|
|---|
| 25 |
|
|---|
| 26 | dnl Define HAVE_STRUCT_TIMESPEC if `struct timespec' is declared
|
|---|
| 27 | dnl in time.h or sys/time.h.
|
|---|
| 28 |
|
|---|
| 29 | AC_DEFUN([gl_CHECK_TYPE_STRUCT_TIMESPEC],
|
|---|
| 30 | [
|
|---|
| 31 | dnl Persuade pedantic Solaris to declare struct timespec.
|
|---|
| 32 | AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
|
|---|
| 33 |
|
|---|
| 34 | AC_REQUIRE([AC_HEADER_TIME])
|
|---|
| 35 | AC_CHECK_HEADERS_ONCE(sys/time.h)
|
|---|
| 36 | AC_CACHE_CHECK([for struct timespec], fu_cv_sys_struct_timespec,
|
|---|
| 37 | [AC_TRY_COMPILE(
|
|---|
| 38 | [
|
|---|
| 39 | # if TIME_WITH_SYS_TIME
|
|---|
| 40 | # include <sys/time.h>
|
|---|
| 41 | # include <time.h>
|
|---|
| 42 | # else
|
|---|
| 43 | # if HAVE_SYS_TIME_H
|
|---|
| 44 | # include <sys/time.h>
|
|---|
| 45 | # else
|
|---|
| 46 | # include <time.h>
|
|---|
| 47 | # endif
|
|---|
| 48 | # endif
|
|---|
| 49 | ],
|
|---|
| 50 | [static struct timespec x; x.tv_sec = x.tv_nsec;],
|
|---|
| 51 | fu_cv_sys_struct_timespec=yes,
|
|---|
| 52 | fu_cv_sys_struct_timespec=no)
|
|---|
| 53 | ])
|
|---|
| 54 |
|
|---|
| 55 | if test $fu_cv_sys_struct_timespec = yes; then
|
|---|
| 56 | AC_DEFINE(HAVE_STRUCT_TIMESPEC, 1,
|
|---|
| 57 | [Define if struct timespec is declared in <time.h>. ])
|
|---|
| 58 | fi
|
|---|
| 59 | ])
|
|---|