| 1 | # serial 20
|
|---|
| 2 | # Configure fcntl.h.
|
|---|
| 3 | dnl Copyright (C) 2006-2007, 2009-2021 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.
|
|---|
| 7 |
|
|---|
| 8 | dnl Written by Paul Eggert.
|
|---|
| 9 |
|
|---|
| 10 | AC_DEFUN_ONCE([gl_FCNTL_H],
|
|---|
| 11 | [
|
|---|
| 12 | AC_REQUIRE([gl_FCNTL_H_DEFAULTS])
|
|---|
| 13 | AC_REQUIRE([gl_FCNTL_O_FLAGS])
|
|---|
| 14 | gl_NEXT_HEADERS([fcntl.h])
|
|---|
| 15 |
|
|---|
| 16 | dnl Ensure the type pid_t gets defined.
|
|---|
| 17 | AC_REQUIRE([AC_TYPE_PID_T])
|
|---|
| 18 |
|
|---|
| 19 | dnl Ensure the type mode_t gets defined.
|
|---|
| 20 | AC_REQUIRE([AC_TYPE_MODE_T])
|
|---|
| 21 |
|
|---|
| 22 | dnl Check for declarations of anything we want to poison if the
|
|---|
| 23 | dnl corresponding gnulib module is not in use, if it is not common
|
|---|
| 24 | dnl enough to be declared everywhere.
|
|---|
| 25 | gl_WARN_ON_USE_PREPARE([[#include <fcntl.h>
|
|---|
| 26 | ]], [fcntl openat])
|
|---|
| 27 | ])
|
|---|
| 28 |
|
|---|
| 29 | # gl_FCNTL_MODULE_INDICATOR([modulename])
|
|---|
| 30 | # sets the shell variable that indicates the presence of the given module
|
|---|
| 31 | # to a C preprocessor expression that will evaluate to 1.
|
|---|
| 32 | # This macro invocation must not occur in macros that are AC_REQUIREd.
|
|---|
| 33 | AC_DEFUN([gl_FCNTL_MODULE_INDICATOR],
|
|---|
| 34 | [
|
|---|
| 35 | dnl Ensure to expand the default settings once only.
|
|---|
| 36 | gl_FCNTL_H_REQUIRE_DEFAULTS
|
|---|
| 37 | gl_MODULE_INDICATOR_SET_VARIABLE([$1])
|
|---|
| 38 | dnl Define it also as a C macro, for the benefit of the unit tests.
|
|---|
| 39 | gl_MODULE_INDICATOR_FOR_TESTS([$1])
|
|---|
| 40 | ])
|
|---|
| 41 |
|
|---|
| 42 | # Initializes the default values for AC_SUBSTed shell variables.
|
|---|
| 43 | # This macro must not be AC_REQUIREd. It must only be invoked, and only
|
|---|
| 44 | # outside of macros or in macros that are not AC_REQUIREd.
|
|---|
| 45 | AC_DEFUN([gl_FCNTL_H_REQUIRE_DEFAULTS],
|
|---|
| 46 | [
|
|---|
| 47 | m4_defun(GL_MODULE_INDICATOR_PREFIX[_FCNTL_H_MODULE_INDICATOR_DEFAULTS], [
|
|---|
| 48 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CREAT])
|
|---|
| 49 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FCNTL])
|
|---|
| 50 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_NONBLOCKING])
|
|---|
| 51 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_OPEN])
|
|---|
| 52 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_OPENAT])
|
|---|
| 53 | dnl Support Microsoft deprecated alias function names by default.
|
|---|
| 54 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_CREAT], [1])
|
|---|
| 55 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_OPEN], [1])
|
|---|
| 56 | ])
|
|---|
| 57 | m4_require(GL_MODULE_INDICATOR_PREFIX[_FCNTL_H_MODULE_INDICATOR_DEFAULTS])
|
|---|
| 58 | AC_REQUIRE([gl_FCNTL_H_DEFAULTS])
|
|---|
| 59 | ])
|
|---|
| 60 |
|
|---|
| 61 | AC_DEFUN([gl_FCNTL_H_DEFAULTS],
|
|---|
| 62 | [
|
|---|
| 63 | dnl Assume proper GNU behavior unless another module says otherwise.
|
|---|
| 64 | HAVE_FCNTL=1; AC_SUBST([HAVE_FCNTL])
|
|---|
| 65 | HAVE_OPENAT=1; AC_SUBST([HAVE_OPENAT])
|
|---|
| 66 | REPLACE_CREAT=0; AC_SUBST([REPLACE_CREAT])
|
|---|
| 67 | REPLACE_FCNTL=0; AC_SUBST([REPLACE_FCNTL])
|
|---|
| 68 | REPLACE_OPEN=0; AC_SUBST([REPLACE_OPEN])
|
|---|
| 69 | REPLACE_OPENAT=0; AC_SUBST([REPLACE_OPENAT])
|
|---|
| 70 | ])
|
|---|