3 dnl Copyright (C) 2007-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.
7 dnl This file is offered as-is, without any warranty.
9 AC_DEFUN([gl_FUNC_OPEN],
11 AC_REQUIRE([AC_CANONICAL_HOST])
12 AC_REQUIRE([gl_PREPROC_O_CLOEXEC])
14 mingw* | windows* | pw*)
18 dnl open("foo/") should not create a file when the file name has a
19 dnl trailing slash. FreeBSD only has the problem on symlinks.
20 AC_CHECK_FUNCS_ONCE([lstat])
21 if test "$gl_cv_macro_O_CLOEXEC" != yes; then
24 gl_OPEN_TRAILING_SLASH_BUG
25 case "$gl_cv_func_open_slash" in
32 dnl Replace open() for supporting the gnulib-defined fchdir() function,
33 dnl to keep fchdir's bookkeeping up-to-date.
34 m4_ifdef([gl_FUNC_FCHDIR], [
35 if test $REPLACE_OPEN = 0; then
37 if test $HAVE_FCHDIR = 0; then
42 dnl Replace open() for supporting the gnulib-defined O_NONBLOCK flag.
43 m4_ifdef([gl_NONBLOCKING_IO], [
44 if test $REPLACE_OPEN = 0; then
46 if test $gl_cv_have_open_O_NONBLOCK != yes; then
53 # Prerequisites of lib/open.c.
54 AC_DEFUN([gl_PREREQ_OPEN],
56 AC_REQUIRE([gl_PROMOTED_TYPE_MODE_T])