From: Jim Meyering Date: Thu, 1 Nov 2001 16:55:16 +0000 (+0000) Subject: use AC_HEADER_DIRECT and all the associated cruft X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=39ce2a1909d1f2562f4a59974b97d3ec6217c5bc;p=pspp use AC_HEADER_DIRECT and all the associated cruft --- diff --git a/m4/dirfd.m4 b/m4/dirfd.m4 index fce3e99c6d..fee5fb2ec7 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 +#else /* not HAVE_DIRENT_H */ +# define dirent direct +# if HAVE_SYS_NDIR_H +# include +# endif /* HAVE_SYS_NDIR_H */ +# if HAVE_SYS_DIR_H +# include +# endif /* HAVE_SYS_DIR_H */ +# if HAVE_NDIR_H +# include +# 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 -#include + [$dirfd_headers ], [DIR *dir_p = opendir("."); (void) ($ac_expr);], dir_fd_done=yes