3 dnl Copyright (C) 2006-2007, 2009-2024 Free Software Foundation, Inc.
4 dnl This file is free software; the Free Software Foundation
5 dnl gives unlimited permission to copy and/or distribute it,
6 dnl with or without modifications, as long as this notice is preserved.
10 dnl Written by Paul Eggert.
12 AC_DEFUN_ONCE([gl_FCNTL_H],
14 AC_REQUIRE([gl_FCNTL_H_DEFAULTS])
15 AC_REQUIRE([gl_FCNTL_O_FLAGS])
16 gl_NEXT_HEADERS([fcntl.h])
18 dnl Ensure the type pid_t gets defined.
19 AC_REQUIRE([AC_TYPE_PID_T])
21 dnl Ensure the type mode_t gets defined.
22 AC_REQUIRE([AC_TYPE_MODE_T])
24 dnl Check for declarations of anything we want to poison if the
25 dnl corresponding gnulib module is not in use, if it is not common
26 dnl enough to be declared everywhere.
27 gl_WARN_ON_USE_PREPARE([[#include <fcntl.h>
31 # gl_FCNTL_MODULE_INDICATOR([modulename])
32 # sets the shell variable that indicates the presence of the given module
33 # to a C preprocessor expression that will evaluate to 1.
34 # This macro invocation must not occur in macros that are AC_REQUIREd.
35 AC_DEFUN([gl_FCNTL_MODULE_INDICATOR],
37 dnl Ensure to expand the default settings once only.
38 gl_FCNTL_H_REQUIRE_DEFAULTS
39 gl_MODULE_INDICATOR_SET_VARIABLE([$1])
40 dnl Define it also as a C macro, for the benefit of the unit tests.
41 gl_MODULE_INDICATOR_FOR_TESTS([$1])
44 # Initializes the default values for AC_SUBSTed shell variables.
45 # This macro must not be AC_REQUIREd. It must only be invoked, and only
46 # outside of macros or in macros that are not AC_REQUIREd.
47 AC_DEFUN([gl_FCNTL_H_REQUIRE_DEFAULTS],
49 m4_defun(GL_MODULE_INDICATOR_PREFIX[_FCNTL_H_MODULE_INDICATOR_DEFAULTS], [
50 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CREAT])
51 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FCNTL])
52 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_NONBLOCKING])
53 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_OPEN])
54 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_OPENAT])
55 dnl Support Microsoft deprecated alias function names by default.
56 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_CREAT], [1])
57 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_OPEN], [1])
59 m4_require(GL_MODULE_INDICATOR_PREFIX[_FCNTL_H_MODULE_INDICATOR_DEFAULTS])
60 AC_REQUIRE([gl_FCNTL_H_DEFAULTS])
63 AC_DEFUN([gl_FCNTL_H_DEFAULTS],
65 dnl Assume proper GNU behavior unless another module says otherwise.
66 HAVE_FCNTL=1; AC_SUBST([HAVE_FCNTL])
67 HAVE_OPENAT=1; AC_SUBST([HAVE_OPENAT])
68 REPLACE_CREAT=0; AC_SUBST([REPLACE_CREAT])
69 REPLACE_FCNTL=0; AC_SUBST([REPLACE_FCNTL])
70 REPLACE_OPEN=0; AC_SUBST([REPLACE_OPEN])
71 REPLACE_OPENAT=0; AC_SUBST([REPLACE_OPENAT])