diff options
author | Thomas Guyot-Sionnest <dermoth@aei.ca> | 2010-04-08 01:11:46 (GMT) |
---|---|---|
committer | Thomas Guyot-Sionnest <dermoth@aei.ca> | 2010-04-13 01:26:35 (GMT) |
commit | 74da141e618ef99959d509cb2e7be35a348a39db (patch) | |
tree | 88ebc38b381a1021fc2d74864a71e230ae591c3d /gl/m4/fcntl_h.m4 | |
parent | c63a4f726a0b6ad8cf6040f947754a81fd4683bb (diff) | |
download | monitoring-plugins-74da141e618ef99959d509cb2e7be35a348a39db.tar.gz |
Sync with the latest Gnulib code (177f525)
Signed-off-by: Thomas Guyot-Sionnest <dermoth@aei.ca>
Diffstat (limited to 'gl/m4/fcntl_h.m4')
-rw-r--r-- | gl/m4/fcntl_h.m4 | 93 |
1 files changed, 20 insertions, 73 deletions
diff --git a/gl/m4/fcntl_h.m4 b/gl/m4/fcntl_h.m4 index 1ae0b15..e41915c 100644 --- a/gl/m4/fcntl_h.m4 +++ b/gl/m4/fcntl_h.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # serial 12 | ||
1 | # Configure fcntl.h. | 2 | # Configure fcntl.h. |
2 | dnl Copyright (C) 2006, 2007, 2009 Free Software Foundation, Inc. | 3 | dnl Copyright (C) 2006, 2007, 2009, 2010 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
@@ -9,88 +10,34 @@ dnl Written by Paul Eggert. | |||
9 | AC_DEFUN([gl_FCNTL_H], | 10 | AC_DEFUN([gl_FCNTL_H], |
10 | [ | 11 | [ |
11 | AC_REQUIRE([gl_FCNTL_H_DEFAULTS]) | 12 | AC_REQUIRE([gl_FCNTL_H_DEFAULTS]) |
12 | dnl Persuade glibc <fcntl.h> to define O_NOATIME and O_NOFOLLOW. | 13 | AC_REQUIRE([gl_FCNTL_O_FLAGS]) |
13 | AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) | ||
14 | AC_CACHE_CHECK([for working fcntl.h], [gl_cv_header_working_fcntl_h], | ||
15 | [AC_RUN_IFELSE( | ||
16 | [AC_LANG_PROGRAM( | ||
17 | [[#include <sys/types.h> | ||
18 | #include <sys/stat.h> | ||
19 | #include <unistd.h> | ||
20 | #include <fcntl.h> | ||
21 | #ifndef O_NOATIME | ||
22 | #define O_NOATIME 0 | ||
23 | #endif | ||
24 | #ifndef O_NOFOLLOW | ||
25 | #define O_NOFOLLOW 0 | ||
26 | #endif | ||
27 | static int const constants[] = | ||
28 | { | ||
29 | O_CREAT, O_EXCL, O_NOCTTY, O_TRUNC, O_APPEND, | ||
30 | O_NONBLOCK, O_SYNC, O_ACCMODE, O_RDONLY, O_RDWR, O_WRONLY | ||
31 | }; | ||
32 | ]], | ||
33 | [[ | ||
34 | int status = !constants; | ||
35 | { | ||
36 | static char const sym[] = "conftest.sym"; | ||
37 | if (symlink (".", sym) != 0 | ||
38 | || close (open (sym, O_RDONLY | O_NOFOLLOW)) == 0) | ||
39 | status |= 32; | ||
40 | } | ||
41 | { | ||
42 | static char const file[] = "confdefs.h"; | ||
43 | int fd = open (file, O_RDONLY | O_NOATIME); | ||
44 | char c; | ||
45 | struct stat st0, st1; | ||
46 | if (fd < 0 | ||
47 | || fstat (fd, &st0) != 0 | ||
48 | || sleep (1) != 0 | ||
49 | || read (fd, &c, 1) != 1 | ||
50 | || close (fd) != 0 | ||
51 | || stat (file, &st1) != 0 | ||
52 | || st0.st_atime != st1.st_atime) | ||
53 | status |= 64; | ||
54 | } | ||
55 | return status;]])], | ||
56 | [gl_cv_header_working_fcntl_h=yes], | ||
57 | [case $? in #( | ||
58 | 32) gl_cv_header_working_fcntl_h='no (bad O_NOFOLLOW)';; #( | ||
59 | 64) gl_cv_header_working_fcntl_h='no (bad O_NOATIME)';; #( | ||
60 | 96) gl_cv_header_working_fcntl_h='no (bad O_NOATIME, O_NOFOLLOW)';; #( | ||
61 | *) gl_cv_header_working_fcntl_h='no';; | ||
62 | esac], | ||
63 | [gl_cv_header_working_fcntl_h=cross-compiling])]) | ||
64 | |||
65 | case $gl_cv_header_working_fcntl_h in #( | ||
66 | *O_NOATIME* | no | cross-compiling) ac_val=0;; #( | ||
67 | *) ac_val=1;; | ||
68 | esac | ||
69 | AC_DEFINE_UNQUOTED([HAVE_WORKING_O_NOATIME], [$ac_val], | ||
70 | [Define to 1 if O_NOATIME works.]) | ||
71 | |||
72 | case $gl_cv_header_working_fcntl_h in #( | ||
73 | *O_NOFOLLOW* | no | cross-compiling) ac_val=0;; #( | ||
74 | *) ac_val=1;; | ||
75 | esac | ||
76 | AC_DEFINE_UNQUOTED([HAVE_WORKING_O_NOFOLLOW], [$ac_val], | ||
77 | [Define to 1 if O_NOFOLLOW works.]) | ||
78 | |||
79 | gl_CHECK_NEXT_HEADERS([fcntl.h]) | 14 | gl_CHECK_NEXT_HEADERS([fcntl.h]) |
80 | FCNTL_H='fcntl.h' | 15 | |
81 | AC_SUBST([FCNTL_H]) | 16 | dnl Check for declarations of anything we want to poison if the |
17 | dnl corresponding gnulib module is not in use, if it is not common | ||
18 | dnl enough to be declared everywhere. | ||
19 | gl_WARN_ON_USE_PREPARE([[#include <fcntl.h> | ||
20 | ]], [fcntl openat]) | ||
82 | ]) | 21 | ]) |
83 | 22 | ||
84 | AC_DEFUN([gl_FCNTL_MODULE_INDICATOR], | 23 | AC_DEFUN([gl_FCNTL_MODULE_INDICATOR], |
85 | [ | 24 | [ |
86 | dnl Use AC_REQUIRE here, so that the default settings are expanded once only. | 25 | dnl Use AC_REQUIRE here, so that the default settings are expanded once only. |
87 | AC_REQUIRE([gl_FCNTL_H_DEFAULTS]) | 26 | AC_REQUIRE([gl_FCNTL_H_DEFAULTS]) |
88 | GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1 | 27 | gl_MODULE_INDICATOR_SET_VARIABLE([$1]) |
28 | dnl Define it also as a C macro, for the benefit of the unit tests. | ||
29 | gl_MODULE_INDICATOR_FOR_TESTS([$1]) | ||
89 | ]) | 30 | ]) |
90 | 31 | ||
91 | AC_DEFUN([gl_FCNTL_H_DEFAULTS], | 32 | AC_DEFUN([gl_FCNTL_H_DEFAULTS], |
92 | [ | 33 | [ |
93 | GNULIB_OPEN=0; AC_SUBST([GNULIB_OPEN]) | 34 | GNULIB_FCNTL=0; AC_SUBST([GNULIB_FCNTL]) |
35 | GNULIB_OPEN=0; AC_SUBST([GNULIB_OPEN]) | ||
36 | GNULIB_OPENAT=0; AC_SUBST([GNULIB_OPENAT]) | ||
94 | dnl Assume proper GNU behavior unless another module says otherwise. | 37 | dnl Assume proper GNU behavior unless another module says otherwise. |
95 | REPLACE_OPEN=0; AC_SUBST([REPLACE_OPEN]) | 38 | HAVE_FCNTL=1; AC_SUBST([HAVE_FCNTL]) |
39 | HAVE_OPENAT=1; AC_SUBST([HAVE_OPENAT]) | ||
40 | REPLACE_FCNTL=0; AC_SUBST([REPLACE_FCNTL]) | ||
41 | REPLACE_OPEN=0; AC_SUBST([REPLACE_OPEN]) | ||
42 | REPLACE_OPENAT=0; AC_SUBST([REPLACE_OPENAT]) | ||
96 | ]) | 43 | ]) |