From c10a73a1812e4885f3b84992277606dee85710cb Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Tue, 22 Jan 2008 01:00:12 +0000 Subject: Detect whether struct DIR has d_fd or dd_fd member and define the dirfd() macro accordingly. --- configure.ac | 2 ++ lib/common/BoxPlatform.h | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 0cca65a9..8d37cea0 100644 --- a/configure.ac +++ b/configure.ac @@ -159,6 +159,8 @@ AC_CHECK_MEMBERS([struct sockaddr_in.sin_len],,, [[ #include #include ]]) +AC_CHECK_MEMBERS([DIR.d_fd],,, [[#include ]]) +AC_CHECK_MEMBERS([DIR.dd_fd],,, [[#include ]]) AC_CHECK_DECLS([INFTIM],,, [[#include ]]) AC_CHECK_DECLS([SO_PEERCRED],,, [[#include ]]) diff --git a/lib/common/BoxPlatform.h b/lib/common/BoxPlatform.h index af595e04..2f0096aa 100644 --- a/lib/common/BoxPlatform.h +++ b/lib/common/BoxPlatform.h @@ -170,7 +170,13 @@ // so do it here instead of in configure.ac. #if ! HAVE_DECL_DIRFD - #define dirfd(x) (x)->d_fd + #ifdef HAVE_DIR_D_FD + #define dirfd(x) (x)->d_fd + #elif defined HAVE_DIR_DD_FD + #define dirfd(x) (x)->dd_fd + #else + #error No way to get file descriptor from DIR structure + #endif #endif #endif // BOXPLATFORM__H -- cgit v1.2.3