Blame m4/close.m4

Packit Service a2489d
# close.m4 serial 9
Packit Service a2489d
dnl Copyright (C) 2008-2018 Free Software Foundation, Inc.
Packit Service a2489d
dnl This file is free software; the Free Software Foundation
Packit Service a2489d
dnl gives unlimited permission to copy and/or distribute it,
Packit Service a2489d
dnl with or without modifications, as long as this notice is preserved.
Packit Service a2489d
Packit Service a2489d
AC_DEFUN([gl_FUNC_CLOSE],
Packit Service a2489d
[
Packit Service a2489d
  AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
Packit Service a2489d
  m4_ifdef([gl_MSVC_INVAL], [
Packit Service a2489d
    AC_REQUIRE([gl_MSVC_INVAL])
Packit Service a2489d
    if test $HAVE_MSVC_INVALID_PARAMETER_HANDLER = 1; then
Packit Service a2489d
      REPLACE_CLOSE=1
Packit Service a2489d
    fi
Packit Service a2489d
  ])
Packit Service a2489d
  m4_ifdef([gl_PREREQ_SYS_H_WINSOCK2], [
Packit Service a2489d
    gl_PREREQ_SYS_H_WINSOCK2
Packit Service a2489d
    if test $UNISTD_H_HAVE_WINSOCK2_H = 1; then
Packit Service a2489d
      dnl Even if the 'socket' module is not used here, another part of the
Packit Service a2489d
      dnl application may use it and pass file descriptors that refer to
Packit Service a2489d
      dnl sockets to the close() function. So enable the support for sockets.
Packit Service a2489d
      REPLACE_CLOSE=1
Packit Service a2489d
    fi
Packit Service a2489d
  ])
Packit Service a2489d
  dnl Replace close() for supporting the gnulib-defined fchdir() function,
Packit Service a2489d
  dnl to keep fchdir's bookkeeping up-to-date.
Packit Service a2489d
  m4_ifdef([gl_FUNC_FCHDIR], [
Packit Service a2489d
    if test $REPLACE_CLOSE = 0; then
Packit Service a2489d
      gl_TEST_FCHDIR
Packit Service a2489d
      if test $HAVE_FCHDIR = 0; then
Packit Service a2489d
        REPLACE_CLOSE=1
Packit Service a2489d
      fi
Packit Service a2489d
    fi
Packit Service a2489d
  ])
Packit Service a2489d
])