diff options
author | RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> | 2023-02-19 13:39:08 (GMT) |
---|---|---|
committer | RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> | 2023-02-19 13:39:08 (GMT) |
commit | 74b6984047d330a3cc7cb7f63645849fe7676c63 (patch) | |
tree | 65a26800103d8d66f7e6cb4acfbfc9f315ec750b /gl/m4/stat-time.m4 | |
parent | 423284edfa980fc3fdb51ab20af96685a988ba97 (diff) | |
parent | c07206f2ccc2356aa74bc6813a94c2190017d44e (diff) | |
download | monitoring-plugins-74b6984047d330a3cc7cb7f63645849fe7676c63.tar.gz |
Merge branch 'master' into check_icmp_cleanuprefs/pull/1807/head
Diffstat (limited to 'gl/m4/stat-time.m4')
-rw-r--r-- | gl/m4/stat-time.m4 | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/gl/m4/stat-time.m4 b/gl/m4/stat-time.m4 new file mode 100644 index 0000000..40993d5 --- /dev/null +++ b/gl/m4/stat-time.m4 | |||
@@ -0,0 +1,83 @@ | |||
1 | # Checks for stat-related time functions. | ||
2 | |||
3 | # Copyright (C) 1998-1999, 2001, 2003, 2005-2007, 2009-2023 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 | |||
10 | dnl From Paul Eggert. | ||
11 | |||
12 | # st_atim.tv_nsec - Linux, Solaris, Cygwin | ||
13 | # st_atimespec.tv_nsec - FreeBSD, NetBSD, if ! defined _POSIX_SOURCE | ||
14 | # st_atimensec - FreeBSD, NetBSD, if defined _POSIX_SOURCE | ||
15 | # st_atim.st__tim.tv_nsec - UnixWare (at least 2.1.2 through 7.1) | ||
16 | |||
17 | # st_birthtimespec - FreeBSD, NetBSD (hidden on OpenBSD 3.9, anyway) | ||
18 | # st_birthtim - Cygwin 1.7.0+ | ||
19 | |||
20 | AC_DEFUN([gl_STAT_TIME], | ||
21 | [ | ||
22 | AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) | ||
23 | AC_CHECK_HEADERS_ONCE([sys/time.h]) | ||
24 | |||
25 | AC_CHECK_MEMBERS([struct stat.st_atim.tv_nsec], | ||
26 | [AC_CACHE_CHECK([whether struct stat.st_atim is of type struct timespec], | ||
27 | [ac_cv_typeof_struct_stat_st_atim_is_struct_timespec], | ||
28 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM( | ||
29 | [[ | ||
30 | #include <sys/types.h> | ||
31 | #include <sys/stat.h> | ||
32 | #if HAVE_SYS_TIME_H | ||
33 | # include <sys/time.h> | ||
34 | #endif | ||
35 | #include <time.h> | ||
36 | struct timespec ts; | ||
37 | struct stat st; | ||
38 | ]], | ||
39 | [[ | ||
40 | st.st_atim = ts; | ||
41 | ]])], | ||
42 | [ac_cv_typeof_struct_stat_st_atim_is_struct_timespec=yes], | ||
43 | [ac_cv_typeof_struct_stat_st_atim_is_struct_timespec=no])]) | ||
44 | if test $ac_cv_typeof_struct_stat_st_atim_is_struct_timespec = yes; then | ||
45 | AC_DEFINE([TYPEOF_STRUCT_STAT_ST_ATIM_IS_STRUCT_TIMESPEC], [1], | ||
46 | [Define to 1 if the type of the st_atim member of a struct stat is | ||
47 | struct timespec.]) | ||
48 | fi], | ||
49 | [AC_CHECK_MEMBERS([struct stat.st_atimespec.tv_nsec], [], | ||
50 | [AC_CHECK_MEMBERS([struct stat.st_atimensec], [], | ||
51 | [AC_CHECK_MEMBERS([struct stat.st_atim.st__tim.tv_nsec], [], [], | ||
52 | [#include <sys/types.h> | ||
53 | #include <sys/stat.h>])], | ||
54 | [#include <sys/types.h> | ||
55 | #include <sys/stat.h>])], | ||
56 | [#include <sys/types.h> | ||
57 | #include <sys/stat.h>])], | ||
58 | [#include <sys/types.h> | ||
59 | #include <sys/stat.h>]) | ||
60 | ]) | ||
61 | |||
62 | # Check for st_birthtime, a feature from UFS2 (FreeBSD, NetBSD, OpenBSD, etc.) | ||
63 | # and NTFS (Cygwin). | ||
64 | # There was a time when this field was named st_createtime (21 June | ||
65 | # 2002 to 16 July 2002) But that window is very small and applied only | ||
66 | # to development code, so systems still using that configuration are | ||
67 | # not supported. See revisions 1.10 and 1.11 of FreeBSD's | ||
68 | # src/sys/ufs/ufs/dinode.h. | ||
69 | # | ||
70 | AC_DEFUN([gl_STAT_BIRTHTIME], | ||
71 | [ | ||
72 | AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) | ||
73 | AC_CHECK_HEADERS_ONCE([sys/time.h]) | ||
74 | AC_CHECK_MEMBERS([struct stat.st_birthtimespec.tv_nsec], [], | ||
75 | [AC_CHECK_MEMBERS([struct stat.st_birthtimensec], [], | ||
76 | [AC_CHECK_MEMBERS([struct stat.st_birthtim.tv_nsec], [], [], | ||
77 | [#include <sys/types.h> | ||
78 | #include <sys/stat.h>])], | ||
79 | [#include <sys/types.h> | ||
80 | #include <sys/stat.h>])], | ||
81 | [#include <sys/types.h> | ||
82 | #include <sys/stat.h>]) | ||
83 | ]) | ||