opendir.m4 961 B

1234567891011121314151617181920212223242526272829303132
  1. # opendir.m4 serial 5
  2. dnl Copyright (C) 2011-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_OPENDIR],
  7. [
  8. AC_REQUIRE([gl_DIRENT_H_DEFAULTS])
  9. AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
  10. AC_CHECK_FUNCS([opendir])
  11. if test $ac_cv_func_opendir = no; then
  12. HAVE_OPENDIR=0
  13. fi
  14. dnl Replace opendir() for supporting the gnulib-defined fchdir() function,
  15. dnl to keep fchdir's bookkeeping up-to-date.
  16. m4_ifdef([gl_FUNC_FCHDIR], [
  17. gl_TEST_FCHDIR
  18. if test $HAVE_FCHDIR = 0; then
  19. if test $HAVE_OPENDIR = 1; then
  20. REPLACE_OPENDIR=1
  21. fi
  22. fi
  23. ])
  24. dnl Replace opendir() on OS/2 kLIBC to support dirfd() function replaced
  25. dnl by gnulib.
  26. case $host_os,$HAVE_OPENDIR in
  27. os2*,1)
  28. REPLACE_OPENDIR=1;;
  29. esac
  30. ])