Blame m4/closedir.m4

Packit 8f70b4
# closedir.m4 serial 6
Packit 8f70b4
dnl Copyright (C) 2011-2018 Free Software Foundation, Inc.
Packit 8f70b4
dnl This file is free software; the Free Software Foundation
Packit 8f70b4
dnl gives unlimited permission to copy and/or distribute it,
Packit 8f70b4
dnl with or without modifications, as long as this notice is preserved.
Packit 8f70b4
Packit 8f70b4
AC_DEFUN([gl_FUNC_CLOSEDIR],
Packit 8f70b4
[
Packit 8f70b4
  AC_REQUIRE([gl_DIRENT_H_DEFAULTS])
Packit 8f70b4
  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
Packit 8f70b4
Packit 8f70b4
  AC_CHECK_FUNCS([closedir])
Packit 8f70b4
  if test $ac_cv_func_closedir = no; then
Packit 8f70b4
    HAVE_CLOSEDIR=0
Packit 8f70b4
  fi
Packit 8f70b4
  dnl Replace closedir() for supporting the gnulib-defined fchdir() function,
Packit 8f70b4
  dnl to keep fchdir's bookkeeping up-to-date.
Packit 8f70b4
  m4_ifdef([gl_FUNC_FCHDIR], [
Packit 8f70b4
    gl_TEST_FCHDIR
Packit 8f70b4
    if test $HAVE_FCHDIR = 0; then
Packit 8f70b4
      if test $HAVE_CLOSEDIR = 1; then
Packit 8f70b4
        REPLACE_CLOSEDIR=1
Packit 8f70b4
      fi
Packit 8f70b4
    fi
Packit 8f70b4
  ])
Packit 8f70b4
  dnl Replace closedir() for supporting the gnulib-defined dirfd() function.
Packit 8f70b4
  case $host_os,$HAVE_CLOSEDIR in
Packit 8f70b4
    os2*,1)
Packit 8f70b4
      REPLACE_CLOSEDIR=1;;
Packit 8f70b4
  esac
Packit 8f70b4
])