]>
Commit | Line | Data |
---|---|---|
ac50fbac CR |
1 | # Configure checks for struct timespec |
2 | ||
3 | # Copyright (C) 2000-2001, 2003-2007, 2009-2011, 2012 Free Software Foundation, Inc. | |
4 | ||
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. | |
8 | ||
9 | # Original written by Paul Eggert and Jim Meyering. | |
10 | # Modified by Chet Ramey for bash | |
11 | ||
12 | dnl Define HAVE_STRUCT_TIMESPEC if `struct timespec' is declared | |
13 | dnl in time.h, sys/time.h, or pthread.h. | |
14 | ||
15 | AC_DEFUN([BASH_CHECK_TYPE_STRUCT_TIMESPEC], | |
16 | [ | |
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], | |
20 | [AC_COMPILE_IFELSE( | |
21 | [AC_LANG_PROGRAM( | |
22 | [[#include <time.h> | |
23 | ]], | |
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])]) | |
27 | ||
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 | |
36 | else | |
37 | AC_CACHE_CHECK([for struct timespec in <sys/time.h>], | |
38 | [bash_cv_sys_struct_timespec_in_sys_time_h], | |
39 | [AC_COMPILE_IFELSE( | |
40 | [AC_LANG_PROGRAM( | |
41 | [[#include <sys/time.h> | |
42 | ]], | |
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]) | |
50 | else | |
51 | AC_CACHE_CHECK([for struct timespec in <pthread.h>], | |
52 | [bash_cv_sys_struct_timespec_in_pthread_h], | |
53 | [AC_COMPILE_IFELSE( | |
54 | [AC_LANG_PROGRAM( | |
55 | [[#include <pthread.h> | |
56 | ]], | |
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]) | |
64 | fi | |
65 | fi | |
66 | fi | |
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]) | |
70 | ||
71 | ]) |