Blame m4/open.m4

Packit Service 4684c1
# open.m4 serial 15
Packit Service 4684c1
dnl Copyright (C) 2007-2020 Free Software Foundation, Inc.
Packit Service 4684c1
dnl This file is free software; the Free Software Foundation
Packit Service 4684c1
dnl gives unlimited permission to copy and/or distribute it,
Packit Service 4684c1
dnl with or without modifications, as long as this notice is preserved.
Packit Service 4684c1
Packit Service 4684c1
AC_DEFUN([gl_FUNC_OPEN],
Packit Service 4684c1
[
Packit Service 4684c1
  AC_REQUIRE([AC_CANONICAL_HOST])
Packit Service 4684c1
  AC_REQUIRE([gl_PREPROC_O_CLOEXEC])
Packit Service 4684c1
  case "$host_os" in
Packit Service 4684c1
    mingw* | pw*)
Packit Service 4684c1
      REPLACE_OPEN=1
Packit Service 4684c1
      ;;
Packit Service 4684c1
    *)
Packit Service 4684c1
      dnl open("foo/") should not create a file when the file name has a
Packit Service 4684c1
      dnl trailing slash.  FreeBSD only has the problem on symlinks.
Packit Service 4684c1
      AC_CHECK_FUNCS_ONCE([lstat])
Packit Service 4684c1
      if test "$gl_cv_macro_O_CLOEXEC" != yes; then
Packit Service 4684c1
        REPLACE_OPEN=1
Packit Service 4684c1
      fi
Packit Service 4684c1
      gl_OPEN_TRAILING_SLASH_BUG
Packit Service 4684c1
      case "$gl_cv_func_open_slash" in
Packit Service 4684c1
        *no)
Packit Service 4684c1
          REPLACE_OPEN=1
Packit Service 4684c1
          ;;
Packit Service 4684c1
      esac
Packit Service 4684c1
      ;;
Packit Service 4684c1
  esac
Packit Service 4684c1
  dnl Replace open() for supporting the gnulib-defined fchdir() function,
Packit Service 4684c1
  dnl to keep fchdir's bookkeeping up-to-date.
Packit Service 4684c1
  m4_ifdef([gl_FUNC_FCHDIR], [
Packit Service 4684c1
    if test $REPLACE_OPEN = 0; then
Packit Service 4684c1
      gl_TEST_FCHDIR
Packit Service 4684c1
      if test $HAVE_FCHDIR = 0; then
Packit Service 4684c1
        REPLACE_OPEN=1
Packit Service 4684c1
      fi
Packit Service 4684c1
    fi
Packit Service 4684c1
  ])
Packit Service 4684c1
  dnl Replace open() for supporting the gnulib-defined O_NONBLOCK flag.
Packit Service 4684c1
  m4_ifdef([gl_NONBLOCKING_IO], [
Packit Service 4684c1
    if test $REPLACE_OPEN = 0; then
Packit Service 4684c1
      gl_NONBLOCKING_IO
Packit Service 4684c1
      if test $gl_cv_have_open_O_NONBLOCK != yes; then
Packit Service 4684c1
        REPLACE_OPEN=1
Packit Service 4684c1
      fi
Packit Service 4684c1
    fi
Packit Service 4684c1
  ])
Packit Service 4684c1
])
Packit Service 4684c1
Packit Service 4684c1
# Prerequisites of lib/open.c.
Packit Service 4684c1
AC_DEFUN([gl_PREREQ_OPEN],
Packit Service 4684c1
[
Packit Service 4684c1
  AC_REQUIRE([gl_PROMOTED_TYPE_MODE_T])
Packit Service 4684c1
  :
Packit Service 4684c1
])