Blame m4/close.m4

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