1
# Configure checks for struct timespec
3
# Copyright (C) 2000-2001, 2003-2007, 2009-2011, 2012 Free Software Foundation, Inc.
5
# This file is free software; the Free Software Foundation
6
# gives unlimited permission to copy and/or distribute it,
7
# with or without modifications, as long as this notice is preserved.
9
# Original written by Paul Eggert and Jim Meyering.
10
# Modified by Chet Ramey for bash
12
dnl Define HAVE_STRUCT_TIMESPEC if `struct timespec' is declared
13
dnl in time.h, sys/time.h, or pthread.h.
15
AC_DEFUN([BASH_CHECK_TYPE_STRUCT_TIMESPEC],
17
AC_CHECK_HEADERS_ONCE([sys/time.h])
18
AC_CACHE_CHECK([for struct timespec in <time.h>],
19
[bash_cv_sys_struct_timespec_in_time_h],
24
[[static struct timespec x; x.tv_sec = x.tv_nsec;]])],
25
[bash_cv_sys_struct_timespec_in_time_h=yes],
26
[bash_cv_sys_struct_timespec_in_time_h=no])])
28
HAVE_STRUCT_TIMESPEC=0
29
TIME_H_DEFINES_STRUCT_TIMESPEC=0
30
SYS_TIME_H_DEFINES_STRUCT_TIMESPEC=0
31
PTHREAD_H_DEFINES_STRUCT_TIMESPEC=0
32
if test $bash_cv_sys_struct_timespec_in_time_h = yes; then
33
AC_DEFINE([HAVE_STRUCT_TIMESPEC])
34
AC_DEFINE([TIME_H_DEFINES_STRUCT_TIMESPEC])
35
TIME_H_DEFINES_STRUCT_TIMESPEC=1
37
AC_CACHE_CHECK([for struct timespec in <sys/time.h>],
38
[bash_cv_sys_struct_timespec_in_sys_time_h],
41
[[#include <sys/time.h>
43
[[static struct timespec x; x.tv_sec = x.tv_nsec;]])],
44
[bash_cv_sys_struct_timespec_in_sys_time_h=yes],
45
[bash_cv_sys_struct_timespec_in_sys_time_h=no])])
46
if test $bash_cv_sys_struct_timespec_in_sys_time_h = yes; then
47
SYS_TIME_H_DEFINES_STRUCT_TIMESPEC=1
48
AC_DEFINE([HAVE_STRUCT_TIMESPEC])
49
AC_DEFINE([SYS_TIME_H_DEFINES_STRUCT_TIMESPEC])
51
AC_CACHE_CHECK([for struct timespec in <pthread.h>],
52
[bash_cv_sys_struct_timespec_in_pthread_h],
55
[[#include <pthread.h>
57
[[static struct timespec x; x.tv_sec = x.tv_nsec;]])],
58
[bash_cv_sys_struct_timespec_in_pthread_h=yes],
59
[bash_cv_sys_struct_timespec_in_pthread_h=no])])
60
if test $bash_cv_sys_struct_timespec_in_pthread_h = yes; then
61
PTHREAD_H_DEFINES_STRUCT_TIMESPEC=1
62
AC_DEFINE([HAVE_STRUCT_TIMESPEC])
63
AC_DEFINE([PTHREAD_H_DEFINES_STRUCT_TIMESPEC])
67
AC_SUBST([TIME_H_DEFINES_STRUCT_TIMESPEC])
68
AC_SUBST([SYS_TIME_H_DEFINES_STRUCT_TIMESPEC])
69
AC_SUBST([PTHREAD_H_DEFINES_STRUCT_TIMESPEC])