summaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2001-11-01 16:55:16 +0000
committerJim Meyering <jim@meyering.net>2001-11-01 16:55:16 +0000
commit7c102d03c759b0f9d8366931cae9632c2edc8dd2 (patch)
treed0ea023b8659d8c2c031e05e4e38cded036dfd00 /m4
parent0c0ad8da77525da3ac3a5b15a64ebab921961747 (diff)
downloadcoreutils-7c102d03c759b0f9d8366931cae9632c2edc8dd2.tar.xz
use AC_HEADER_DIRECT and all the associated cruft
Diffstat (limited to 'm4')
-rw-r--r--m4/dirfd.m422
1 files changed, 19 insertions, 3 deletions
diff --git a/m4/dirfd.m4 b/m4/dirfd.m4
index fce3e99c6..fee5fb2ec 100644
--- a/m4/dirfd.m4
+++ b/m4/dirfd.m4
@@ -5,8 +5,25 @@ dnl From Jim Meyering
AC_DEFUN([UTILS_FUNC_DIRFD],
[
+ AC_HEADER_DIRENT
AC_REPLACE_FUNCS([dirfd])
- AC_CHECK_DECLS([dirfd])
+ dirfd_headers='
+#if HAVE_DIRENT_H
+# include <dirent.h>
+#else /* not HAVE_DIRENT_H */
+# define dirent direct
+# if HAVE_SYS_NDIR_H
+# include <sys/ndir.h>
+# endif /* HAVE_SYS_NDIR_H */
+# if HAVE_SYS_DIR_H
+# include <sys/dir.h>
+# endif /* HAVE_SYS_DIR_H */
+# if HAVE_NDIR_H
+# include <ndir.h>
+# endif /* HAVE_NDIR_H */
+#endif /* HAVE_DIRENT_H */
+'
+ AC_CHECK_DECLS([dirfd], , , $dirfd_headers)
if test $ac_cv_func_dirfd = no; then
AC_CACHE_CHECK(
[how to get the file descriptor associated with an open DIR*],
@@ -30,8 +47,7 @@ AC_DEFUN([UTILS_FUNC_DIRFD],
DEFS="$DEFS -DDIR_TO_FD=$ac_expr"
AC_TRY_COMPILE(
- [#include <sys/types.h>
-#include <dirent.h>
+ [$dirfd_headers
],
[DIR *dir_p = opendir("."); (void) ($ac_expr);],
dir_fd_done=yes