Use a warranty disclaimer in all-permissive license notices, part 2.
[gnulib.git] / m4 / open.m4
blob600c2ec80dd5ae6a1690a257faaf20edcfd0f4d4
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 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])
13   case "$host_os" in
14     mingw* | windows* | pw*)
15       REPLACE_OPEN=1
16       ;;
17     *)
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
22         REPLACE_OPEN=1
23       fi
24       gl_OPEN_TRAILING_SLASH_BUG
25       case "$gl_cv_func_open_slash" in
26         *no)
27           REPLACE_OPEN=1
28           ;;
29       esac
30       ;;
31   esac
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
36       gl_TEST_FCHDIR
37       if test $HAVE_FCHDIR = 0; then
38         REPLACE_OPEN=1
39       fi
40     fi
41   ])
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
45       gl_NONBLOCKING_IO
46       if test $gl_cv_have_open_O_NONBLOCK != yes; then
47         REPLACE_OPEN=1
48       fi
49     fi
50   ])
53 # Prerequisites of lib/open.c.
54 AC_DEFUN([gl_PREREQ_OPEN],
56   AC_REQUIRE([gl_PROMOTED_TYPE_MODE_T])
57   :