Debian Codegraph @

tools/gnulib/m4/open.m4

raw
1 # open.m4
2 # serial 16
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
8 AC_DEFUN([gl_FUNC_OPEN],
9 [
10 AC_REQUIRE([AC_CANONICAL_HOST])
11 AC_REQUIRE([gl_PREPROC_O_CLOEXEC])
12 case "$host_os" in
13 mingw* | windows* | pw*)
14 REPLACE_OPEN=1
15 ;;
16 *)
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
21 REPLACE_OPEN=1
22 fi
23 gl_OPEN_TRAILING_SLASH_BUG
24 case "$gl_cv_func_open_slash" in
25 *no)
26 REPLACE_OPEN=1
27 ;;
28 esac
29 ;;
30 esac
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
35 gl_TEST_FCHDIR
36 if test $HAVE_FCHDIR = 0; then
37 REPLACE_OPEN=1
38 fi
39 fi
40 ])
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
44 gl_NONBLOCKING_IO
45 if test $gl_cv_have_open_O_NONBLOCK != yes; then
46 REPLACE_OPEN=1
47 fi
48 fi
49 ])
50 ])
51
52 # Prerequisites of lib/open.c.
53 AC_DEFUN([gl_PREREQ_OPEN],
54 [
55 AC_REQUIRE([gl_PROMOTED_TYPE_MODE_T])
56 :
57 ])