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.
8 AC_DEFUN([gl_FUNC_OPEN],
10 AC_REQUIRE([AC_CANONICAL_HOST])
11 AC_REQUIRE([gl_PREPROC_O_CLOEXEC])
13 mingw* | windows* | pw*)
17 dnl open("foo/") should not create a file when the file name has a
18 dnl trailing slash. FreeBSD only has the problem on symlinks.
19 AC_CHECK_FUNCS_ONCE([lstat])
20 if test "$gl_cv_macro_O_CLOEXEC" != yes; then
23 gl_OPEN_TRAILING_SLASH_BUG
24 case "$gl_cv_func_open_slash" in
31 dnl Replace open() for supporting the gnulib-defined fchdir() function,
32 dnl to keep fchdir's bookkeeping up-to-date.
33 m4_ifdef([gl_FUNC_FCHDIR], [
34 if test $REPLACE_OPEN = 0; then
36 if test $HAVE_FCHDIR = 0; then
41 dnl Replace open() for supporting the gnulib-defined O_NONBLOCK flag.
42 m4_ifdef([gl_NONBLOCKING_IO], [
43 if test $REPLACE_OPEN = 0; then
45 if test $gl_cv_have_open_O_NONBLOCK != yes; then
52 # Prerequisites of lib/open.c.
53 AC_DEFUN([gl_PREREQ_OPEN],
55 AC_REQUIRE([gl_PROMOTED_TYPE_MODE_T])