Debian Codegraph @

m4/open.m4

raw
1 # open.m4
2 # serial 17
3 dnl Copyright (C) 2007-2026 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.
8
9 AC_DEFUN([gl_FUNC_OPEN],
10 [
11 AC_REQUIRE([AC_CANONICAL_HOST])
12 AC_REQUIRE([gl_PREPROC_O_CLOEXEC])
13 AC_REQUIRE([gl_FCNTL_O_FLAGS])
14 AS_CASE([$gl_cv_header_working_fcntl_h],
15 [*O_DIRECTORY* | *no], [REPLACE_OPEN=1])
16 case "$host_os" in
17 mingw* | windows* | pw*)
18 REPLACE_OPEN=1
19 ;;
20 *)
21 dnl open("foo/") should not create a file when the file name has a
22 dnl trailing slash. FreeBSD only has the problem on symlinks.
23 AC_CHECK_FUNCS_ONCE([lstat])
24 if test "$gl_cv_macro_O_CLOEXEC" != yes; then
25 REPLACE_OPEN=1
26 fi
27 gl_OPEN_TRAILING_SLASH_BUG
28 case "$gl_cv_func_open_slash" in
29 *no)
30 REPLACE_OPEN=1
31 ;;
32 esac
33 ;;
34 esac
35 dnl Replace open() for supporting the gnulib-defined fchdir() function,
36 dnl to keep fchdir's bookkeeping up-to-date.
37 m4_ifdef([gl_FUNC_FCHDIR], [
38 if test $REPLACE_OPEN = 0; then
39 gl_TEST_FCHDIR
40 if test $HAVE_FCHDIR = 0; then
41 REPLACE_OPEN=1
42 fi
43 fi
44 ])
45 dnl Replace open() for supporting the gnulib-defined O_NONBLOCK flag.
46 m4_ifdef([gl_NONBLOCKING_IO], [
47 if test $REPLACE_OPEN = 0; then
48 gl_NONBLOCKING_IO
49 if test $gl_cv_have_open_O_NONBLOCK != yes; then
50 REPLACE_OPEN=1
51 fi
52 fi
53 ])
54 ])
55
56 # Prerequisites of lib/open.c.
57 AC_DEFUN([gl_PREREQ_OPEN],
58 [
59 AC_REQUIRE([gl_PROMOTED_TYPE_MODE_T])
60 :
61 ])