3 dnl Find out how to get the file descriptor associated with an open DIR*.
6 AC_DEFUN([UTILS_FUNC_DIRFD],
9 AC_REPLACE_FUNCS([dirfd])
13 #else /* not HAVE_DIRENT_H */
14 # define dirent direct
16 # include <sys/ndir.h>
17 # endif /* HAVE_SYS_NDIR_H */
20 # endif /* HAVE_SYS_DIR_H */
23 # endif /* HAVE_NDIR_H */
24 #endif /* HAVE_DIRENT_H */
26 AC_CHECK_DECLS([dirfd], , , $dirfd_headers)
27 if test $ac_cv_func_dirfd = no; then
29 [how to get the file descriptor associated with an open DIR*],
41 '# systems for which the info is not available' \
45 # Skip each embedded comment.
46 case "$ac_expr" in '#'*) continue;; esac
48 DEFS="$DEFS -DDIR_TO_FD=$ac_expr"
52 [DIR *dir_p = opendir("."); (void) ($ac_expr);],
56 test "$dir_fd_done" = yes && break
59 ac_cv_sys_dir_to_fd=$ac_expr
62 AC_DEFINE_UNQUOTED(DIR_TO_FD,
64 [the file descriptor associated with `dir_p'])