2 dnl Copyright (C) 2006 Free Software Foundation, Inc.
3 dnl This file is free software; the Free Software Foundation
4 dnl gives unlimited permission to copy and/or distribute it,
5 dnl with or without modifications, as long as this notice is preserved.
7 dnl Written by Paul Eggert.
11 AC_CACHE_CHECK([for working fcntl.h], gl_cv_header_working_fcntl_h,
14 [[#include <sys/types.h>
24 static int const constants[] =
26 O_CREAT, O_EXCL, O_NOCTTY, O_TRUNC, O_APPEND,
27 O_NONBLOCK, O_SYNC, O_ACCMODE, O_RDONLY, O_RDWR, O_WRONLY
31 int status = !constants;
33 static char const sym[] = "conftest.sym";
34 if (symlink (".", sym) != 0
35 || close (open (sym, O_RDONLY | O_NOFOLLOW)) == 0)
39 static char const file[] = "confdefs.h";
40 int fd = open (file, O_RDONLY | O_NOATIME);
44 || fstat (fd, &st0) != 0
46 || read (fd, &c, 1) != 1
48 || stat (file, &st1) != 0
49 || st0.st_atime != st1.st_atime)
53 [gl_cv_header_working_fcntl_h=yes],
55 32) gl_cv_header_working_fcntl_h='no (bad O_NOFOLLOW)';; #(
56 64) gl_cv_header_working_fcntl_h='no (bad O_NOATIME)';; #(
57 96) gl_cv_header_working_fcntl_h='no (bad O_NOATIME, O_NOFOLLOW)';; #(
58 *) gl_cv_header_working_fcntl_h='no';;
60 [gl_cv_header_working_fcntl_h=cross-compiling])])
62 case $gl_cv_header_working_fcntl_h in #(
63 *O_NOATIME* | no | cross-compiling) ac_val=0;; #(
66 AC_DEFINE_UNQUOTED([HAVE_WORKING_O_NOATIME], [$ac_val],
67 [Define to 1 if O_NOATIME works.])
69 case $gl_cv_header_working_fcntl_h in #(
70 *O_NOFOLLOW* | no | cross-compiling) ac_val=0;; #(
73 AC_DEFINE_UNQUOTED([HAVE_WORKING_O_NOFOLLOW], [$ac_val],
74 [Define to 1 if O_NOFOLLOW works.])
76 gl_ABSOLUTE_HEADER([fcntl.h])
77 ABSOLUTE_FCNTL_H=\"$gl_cv_absolute_fcntl_h\"
78 AC_SUBST([ABSOLUTE_FCNTL_H])