source: trunk/essentials/app-arch/gzip/m4/timespec.m4

Last change on this file was 3325, checked in by bird, 18 years ago

gzip 1.3.11

File size: 1.4 KB
Line 
1#serial 13
2
3# Copyright (C) 2000, 2001, 2003, 2004, 2005, 2006, 2007 Free Software
4# Foundation, Inc.
5
6# This file is free software; the Free Software Foundation
7# gives unlimited permission to copy and/or distribute it,
8# with or without modifications, as long as this notice is preserved.
9
10dnl From Jim Meyering
11
12AC_DEFUN([gl_TIMESPEC],
13[
14 dnl Prerequisites of lib/timespec.h.
15 AC_REQUIRE([AC_C_INLINE])
16 AC_CHECK_HEADERS_ONCE(sys/time.h)
17 gl_CHECK_TYPE_STRUCT_TIMESPEC
18
19 dnl Persuade glibc and Solaris <time.h> to declare nanosleep.
20 AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
21
22 AC_CHECK_DECLS(nanosleep, , , [#include <time.h>])
23])
24
25dnl Define HAVE_STRUCT_TIMESPEC if `struct timespec' is declared
26dnl in time.h or sys/time.h.
27
28AC_DEFUN([gl_CHECK_TYPE_STRUCT_TIMESPEC],
29[
30 dnl Persuade pedantic Solaris to declare struct timespec.
31 AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
32
33 AC_CHECK_HEADERS_ONCE(sys/time.h)
34 AC_CACHE_CHECK([for struct timespec], [gl_cv_sys_struct_timespec],
35 [AC_COMPILE_IFELSE(
36 [AC_LANG_PROGRAM(
37 [[#if HAVE_SYS_TIME_H
38 #include <sys/time.h>
39 #endif
40 #include <time.h>
41 ]],
42 [[static struct timespec x; x.tv_sec = x.tv_nsec;]])],
43 [gl_cv_sys_struct_timespec=yes],
44 [gl_cv_sys_struct_timespec=no])])
45
46 if test $gl_cv_sys_struct_timespec = yes; then
47 AC_DEFINE(HAVE_STRUCT_TIMESPEC, 1,
48 [Define if struct timespec is declared in <time.h>. ])
49 fi
50])
Note: See TracBrowser for help on using the repository browser.