1*56bb7041Schristos# close.m4 serial 9 2*56bb7041Schristosdnl Copyright (C) 2008-2020 Free Software Foundation, Inc. 3*56bb7041Schristosdnl This file is free software; the Free Software Foundation 4*56bb7041Schristosdnl gives unlimited permission to copy and/or distribute it, 5*56bb7041Schristosdnl with or without modifications, as long as this notice is preserved. 6*56bb7041Schristos 7*56bb7041SchristosAC_DEFUN([gl_FUNC_CLOSE], 8*56bb7041Schristos[ 9*56bb7041Schristos AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) 10*56bb7041Schristos m4_ifdef([gl_MSVC_INVAL], [ 11*56bb7041Schristos AC_REQUIRE([gl_MSVC_INVAL]) 12*56bb7041Schristos if test $HAVE_MSVC_INVALID_PARAMETER_HANDLER = 1; then 13*56bb7041Schristos REPLACE_CLOSE=1 14*56bb7041Schristos fi 15*56bb7041Schristos ]) 16*56bb7041Schristos m4_ifdef([gl_PREREQ_SYS_H_WINSOCK2], [ 17*56bb7041Schristos gl_PREREQ_SYS_H_WINSOCK2 18*56bb7041Schristos if test $UNISTD_H_HAVE_WINSOCK2_H = 1; then 19*56bb7041Schristos dnl Even if the 'socket' module is not used here, another part of the 20*56bb7041Schristos dnl application may use it and pass file descriptors that refer to 21*56bb7041Schristos dnl sockets to the close() function. So enable the support for sockets. 22*56bb7041Schristos REPLACE_CLOSE=1 23*56bb7041Schristos fi 24*56bb7041Schristos ]) 25*56bb7041Schristos dnl Replace close() for supporting the gnulib-defined fchdir() function, 26*56bb7041Schristos dnl to keep fchdir's bookkeeping up-to-date. 27*56bb7041Schristos m4_ifdef([gl_FUNC_FCHDIR], [ 28*56bb7041Schristos if test $REPLACE_CLOSE = 0; then 29*56bb7041Schristos gl_TEST_FCHDIR 30*56bb7041Schristos if test $HAVE_FCHDIR = 0; then 31*56bb7041Schristos REPLACE_CLOSE=1 32*56bb7041Schristos fi 33*56bb7041Schristos fi 34*56bb7041Schristos ]) 35*56bb7041Schristos]) 36