dirent_h.m4 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. # dirent_h.m4 serial 16
  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. dnl Written by Bruno Haible.
  7. AC_DEFUN([gl_DIRENT_H],
  8. [
  9. dnl Use AC_REQUIRE here, so that the default behavior below is expanded
  10. dnl once only, before all statements that occur in other macros.
  11. AC_REQUIRE([gl_DIRENT_H_DEFAULTS])
  12. dnl <dirent.h> is always overridden, because of GNULIB_POSIXCHECK.
  13. gl_CHECK_NEXT_HEADERS([dirent.h])
  14. if test $ac_cv_header_dirent_h = yes; then
  15. HAVE_DIRENT_H=1
  16. else
  17. HAVE_DIRENT_H=0
  18. fi
  19. AC_SUBST([HAVE_DIRENT_H])
  20. dnl Check for declarations of anything we want to poison if the
  21. dnl corresponding gnulib module is not in use.
  22. gl_WARN_ON_USE_PREPARE([[#include <dirent.h>
  23. ]], [alphasort closedir dirfd fdopendir opendir readdir rewinddir scandir])
  24. ])
  25. AC_DEFUN([gl_DIRENT_MODULE_INDICATOR],
  26. [
  27. dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
  28. AC_REQUIRE([gl_DIRENT_H_DEFAULTS])
  29. gl_MODULE_INDICATOR_SET_VARIABLE([$1])
  30. dnl Define it also as a C macro, for the benefit of the unit tests.
  31. gl_MODULE_INDICATOR_FOR_TESTS([$1])
  32. ])
  33. AC_DEFUN([gl_DIRENT_H_DEFAULTS],
  34. [
  35. AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) dnl for REPLACE_FCHDIR
  36. GNULIB_OPENDIR=0; AC_SUBST([GNULIB_OPENDIR])
  37. GNULIB_READDIR=0; AC_SUBST([GNULIB_READDIR])
  38. GNULIB_REWINDDIR=0; AC_SUBST([GNULIB_REWINDDIR])
  39. GNULIB_CLOSEDIR=0; AC_SUBST([GNULIB_CLOSEDIR])
  40. GNULIB_DIRFD=0; AC_SUBST([GNULIB_DIRFD])
  41. GNULIB_FDOPENDIR=0; AC_SUBST([GNULIB_FDOPENDIR])
  42. GNULIB_SCANDIR=0; AC_SUBST([GNULIB_SCANDIR])
  43. GNULIB_ALPHASORT=0; AC_SUBST([GNULIB_ALPHASORT])
  44. dnl Assume proper GNU behavior unless another module says otherwise.
  45. HAVE_OPENDIR=1; AC_SUBST([HAVE_OPENDIR])
  46. HAVE_READDIR=1; AC_SUBST([HAVE_READDIR])
  47. HAVE_REWINDDIR=1; AC_SUBST([HAVE_REWINDDIR])
  48. HAVE_CLOSEDIR=1; AC_SUBST([HAVE_CLOSEDIR])
  49. HAVE_DECL_DIRFD=1; AC_SUBST([HAVE_DECL_DIRFD])
  50. HAVE_DECL_FDOPENDIR=1;AC_SUBST([HAVE_DECL_FDOPENDIR])
  51. HAVE_FDOPENDIR=1; AC_SUBST([HAVE_FDOPENDIR])
  52. HAVE_SCANDIR=1; AC_SUBST([HAVE_SCANDIR])
  53. HAVE_ALPHASORT=1; AC_SUBST([HAVE_ALPHASORT])
  54. REPLACE_OPENDIR=0; AC_SUBST([REPLACE_OPENDIR])
  55. REPLACE_CLOSEDIR=0; AC_SUBST([REPLACE_CLOSEDIR])
  56. REPLACE_DIRFD=0; AC_SUBST([REPLACE_DIRFD])
  57. REPLACE_FDOPENDIR=0; AC_SUBST([REPLACE_FDOPENDIR])
  58. ])