3 dnl Find out how to get the file descriptor associated with an open DIR*.
6 AC_DEFUN([UTILS_FUNC_DIRFD],
12 #else /* not HAVE_DIRENT_H */
13 # define dirent direct
15 # include <sys/ndir.h>
16 # endif /* HAVE_SYS_NDIR_H */
19 # endif /* HAVE_SYS_DIR_H */
22 # endif /* HAVE_NDIR_H */
23 #endif /* HAVE_DIRENT_H */
26 AC_CHECK_DECLS([dirfd], , , $dirfd_headers)
28 # Use the replacement only if we have neither the function
30 if test $ac_cv_func_dirfd,$ac_cv_have_decl_dirfd = no,no; then
31 AC_REPLACE_FUNCS([dirfd])
33 [how to get the file descriptor associated with an open DIR*],
43 '# systems for which the info is not available' \
47 # Skip each embedded comment.
48 case "$ac_expr" in '#'*) continue;; esac
50 DEFS="$DEFS -DDIR_TO_FD=$ac_expr"
54 [DIR *dir_p = opendir("."); (void) ($ac_expr);],
58 test "$dir_fd_done" = yes && break
61 ac_cv_sys_dir_to_fd=$ac_expr
64 AC_DEFINE_UNQUOTED(DIR_TO_FD,
66 [the file descriptor associated with `dir_p'])