Blame m4/closedir.m4

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