diff options
Diffstat (limited to 'gl/m4/open.m4')
-rw-r--r-- | gl/m4/open.m4 | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/gl/m4/open.m4 b/gl/m4/open.m4 new file mode 100644 index 00000000..94fa2bb7 --- /dev/null +++ b/gl/m4/open.m4 | |||
@@ -0,0 +1,56 @@ | |||
1 | # open.m4 serial 15 | ||
2 | dnl Copyright (C) 2007-2023 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | ||
4 | dnl gives unlimited permission to copy and/or distribute it, | ||
5 | dnl with or without modifications, as long as this notice is preserved. | ||
6 | |||
7 | AC_DEFUN([gl_FUNC_OPEN], | ||
8 | [ | ||
9 | AC_REQUIRE([AC_CANONICAL_HOST]) | ||
10 | AC_REQUIRE([gl_PREPROC_O_CLOEXEC]) | ||
11 | case "$host_os" in | ||
12 | mingw* | pw*) | ||
13 | REPLACE_OPEN=1 | ||
14 | ;; | ||
15 | *) | ||
16 | dnl open("foo/") should not create a file when the file name has a | ||
17 | dnl trailing slash. FreeBSD only has the problem on symlinks. | ||
18 | AC_CHECK_FUNCS_ONCE([lstat]) | ||
19 | if test "$gl_cv_macro_O_CLOEXEC" != yes; then | ||
20 | REPLACE_OPEN=1 | ||
21 | fi | ||
22 | gl_OPEN_TRAILING_SLASH_BUG | ||
23 | case "$gl_cv_func_open_slash" in | ||
24 | *no) | ||
25 | REPLACE_OPEN=1 | ||
26 | ;; | ||
27 | esac | ||
28 | ;; | ||
29 | esac | ||
30 | dnl Replace open() for supporting the gnulib-defined fchdir() function, | ||
31 | dnl to keep fchdir's bookkeeping up-to-date. | ||
32 | m4_ifdef([gl_FUNC_FCHDIR], [ | ||
33 | if test $REPLACE_OPEN = 0; then | ||
34 | gl_TEST_FCHDIR | ||
35 | if test $HAVE_FCHDIR = 0; then | ||
36 | REPLACE_OPEN=1 | ||
37 | fi | ||
38 | fi | ||
39 | ]) | ||
40 | dnl Replace open() for supporting the gnulib-defined O_NONBLOCK flag. | ||
41 | m4_ifdef([gl_NONBLOCKING_IO], [ | ||
42 | if test $REPLACE_OPEN = 0; then | ||
43 | gl_NONBLOCKING_IO | ||
44 | if test $gl_cv_have_open_O_NONBLOCK != yes; then | ||
45 | REPLACE_OPEN=1 | ||
46 | fi | ||
47 | fi | ||
48 | ]) | ||
49 | ]) | ||
50 | |||
51 | # Prerequisites of lib/open.c. | ||
52 | AC_DEFUN([gl_PREREQ_OPEN], | ||
53 | [ | ||
54 | AC_REQUIRE([gl_PROMOTED_TYPE_MODE_T]) | ||
55 | : | ||
56 | ]) | ||