9
10
AC_DEFUN([gl_FCNTL_H],
11
12
AC_REQUIRE([gl_FCNTL_H_DEFAULTS])
12
AC_CACHE_CHECK([for working fcntl.h], gl_cv_header_working_fcntl_h,
15
[[#include <sys/types.h>
25
static int const constants[] =
27
O_CREAT, O_EXCL, O_NOCTTY, O_TRUNC, O_APPEND,
28
O_NONBLOCK, O_SYNC, O_ACCMODE, O_RDONLY, O_RDWR, O_WRONLY
32
int status = !constants;
34
static char const sym[] = "conftest.sym";
35
if (symlink (".", sym) != 0
36
|| close (open (sym, O_RDONLY | O_NOFOLLOW)) == 0)
40
static char const file[] = "confdefs.h";
41
int fd = open (file, O_RDONLY | O_NOATIME);
45
|| fstat (fd, &st0) != 0
47
|| read (fd, &c, 1) != 1
49
|| stat (file, &st1) != 0
50
|| st0.st_atime != st1.st_atime)
54
[gl_cv_header_working_fcntl_h=yes],
56
32) gl_cv_header_working_fcntl_h='no (bad O_NOFOLLOW)';; #(
57
64) gl_cv_header_working_fcntl_h='no (bad O_NOATIME)';; #(
58
96) gl_cv_header_working_fcntl_h='no (bad O_NOATIME, O_NOFOLLOW)';; #(
59
*) gl_cv_header_working_fcntl_h='no';;
61
[gl_cv_header_working_fcntl_h=cross-compiling])])
63
case $gl_cv_header_working_fcntl_h in #(
64
*O_NOATIME* | no | cross-compiling) ac_val=0;; #(
67
AC_DEFINE_UNQUOTED([HAVE_WORKING_O_NOATIME], [$ac_val],
68
[Define to 1 if O_NOATIME works.])
70
case $gl_cv_header_working_fcntl_h in #(
71
*O_NOFOLLOW* | no | cross-compiling) ac_val=0;; #(
74
AC_DEFINE_UNQUOTED([HAVE_WORKING_O_NOFOLLOW], [$ac_val],
75
[Define to 1 if O_NOFOLLOW works.])
13
AC_REQUIRE([gl_FCNTL_O_FLAGS])
77
14
gl_CHECK_NEXT_HEADERS([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>
82
23
AC_DEFUN([gl_FCNTL_MODULE_INDICATOR],
84
25
dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
85
26
AC_REQUIRE([gl_FCNTL_H_DEFAULTS])
86
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
32
AC_DEFUN([gl_FCNTL_H_DEFAULTS],
91
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])
92
37
dnl Assume proper GNU behavior unless another module says otherwise.
93
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])