# HG changeset patch # User Jim Meyering # Date 1004686595 0 # Node ID 687d6a0e6a2ba83b1f4ee8a9521c366122d1257d # Parent a61c239d1e454e1365ad2427b94a0de0c315903c Use the replacement only if we have neither the function nor a declaration. diff --git a/m4/dirfd.m4 b/m4/dirfd.m4 --- a/m4/dirfd.m4 +++ b/m4/dirfd.m4 @@ -6,7 +6,6 @@ AC_DEFUN([UTILS_FUNC_DIRFD], [ AC_HEADER_DIRENT - AC_REPLACE_FUNCS([dirfd]) dirfd_headers=' #if HAVE_DIRENT_H # include @@ -23,8 +22,13 @@ # endif /* HAVE_NDIR_H */ #endif /* HAVE_DIRENT_H */ ' + AC_CHECK_FUNCS(dirfd) AC_CHECK_DECLS([dirfd], , , $dirfd_headers) - if test $ac_cv_func_dirfd = no; then + + # Use the replacement only if we have neither the function + # nor a declaration. + if test $ac_cv_func_dirfd,$ac_cv_have_decl_dirfd = no,no; then + AC_REPLACE_FUNCS([dirfd]) AC_CACHE_CHECK( [how to get the file descriptor associated with an open DIR*], ac_cv_sys_dir_to_fd, @@ -32,10 +36,8 @@ dirfd_save_DEFS=$DEFS for ac_expr in \ \ - '# Solaris' \ 'dir_p->d_fd' \ \ - '# Solaris' \ 'dir_p->dd_fd' \ \ '# systems for which the info is not available' \