Blame m4/close.m4

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