dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS])
AC_CHECK_FUNCS_ONCE([fchdir])
if test $ac_cv_func_fchdir = no; then
AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS])
AC_CHECK_FUNCS_ONCE([fchdir])
if test $ac_cv_func_fchdir = no; then
dnl We must also replace anything that can manipulate a directory fd,
dnl to keep our bookkeeping up-to-date. We don't have to replace
dnl fstatat, since no platform has fstatat but lacks fchdir.
dnl We must also replace anything that can manipulate a directory fd,
dnl to keep our bookkeeping up-to-date. We don't have to replace
dnl fstatat, since no platform has fstatat but lacks fchdir.
gl_REPLACE_DIRENT_H
AC_CACHE_CHECK([whether open can visit directories],
[gl_cv_func_open_directory_works],
gl_REPLACE_DIRENT_H
AC_CACHE_CHECK([whether open can visit directories],
[gl_cv_func_open_directory_works],
if test "$gl_cv_func_open_directory_works" != yes; then
AC_DEFINE([REPLACE_OPEN_DIRECTORY], [1], [Define to 1 if open() should
work around the inability to open a directory.])
if test "$gl_cv_func_open_directory_works" != yes; then
AC_DEFINE([REPLACE_OPEN_DIRECTORY], [1], [Define to 1 if open() should
work around the inability to open a directory.])