close.m4 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. # close.m4 serial 9
  2. dnl Copyright (C) 2008-2021 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. AC_DEFUN([gl_FUNC_CLOSE],
  7. [
  8. AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
  9. m4_ifdef([gl_MSVC_INVAL], [
  10. AC_REQUIRE([gl_MSVC_INVAL])
  11. if test $HAVE_MSVC_INVALID_PARAMETER_HANDLER = 1; then
  12. REPLACE_CLOSE=1
  13. fi
  14. ])
  15. m4_ifdef([gl_PREREQ_SYS_H_WINSOCK2], [
  16. gl_PREREQ_SYS_H_WINSOCK2
  17. if test $UNISTD_H_HAVE_WINSOCK2_H = 1; then
  18. dnl Even if the 'socket' module is not used here, another part of the
  19. dnl application may use it and pass file descriptors that refer to
  20. dnl sockets to the close() function. So enable the support for sockets.
  21. REPLACE_CLOSE=1
  22. fi
  23. ])
  24. dnl Replace close() for supporting the gnulib-defined fchdir() function,
  25. dnl to keep fchdir's bookkeeping up-to-date.
  26. m4_ifdef([gl_FUNC_FCHDIR], [
  27. if test $REPLACE_CLOSE = 0; then
  28. gl_TEST_FCHDIR
  29. if test $HAVE_FCHDIR = 0; then
  30. REPLACE_CLOSE=1
  31. fi
  32. fi
  33. ])
  34. ])