diff options
-rw-r--r-- | configure.ac | 8 | ||||
-rw-r--r-- | lib/common/BoxPlatform.h | 8 |
2 files changed, 11 insertions, 5 deletions
diff --git a/configure.ac b/configure.ac index a54690d6..54d917e2 100644 --- a/configure.ac +++ b/configure.ac @@ -165,13 +165,11 @@ AC_CHECK_DECLS([SO_PEERCRED],,, [[#include <sys/socket.h>]]) AC_CHECK_DECLS([O_BINARY],,,) AC_CHECK_DECLS([optreset],,, [[#include <getopt.h>]]) -AC_CHECK_DECL([dirfd], - [], - AC_DEFINE([dirfd(x)], [(x)->d_fd], [dirfd() replacement for Solaris]), - [ +AC_CHECK_DECLS([dirfd],,, + [[ #include <getopt.h> #include <dirent.h> - ]) + ]]) AC_HEADER_TIME AC_STRUCT_TM diff --git a/lib/common/BoxPlatform.h b/lib/common/BoxPlatform.h index 4b58d31d..a3d0e7ad 100644 --- a/lib/common/BoxPlatform.h +++ b/lib/common/BoxPlatform.h @@ -165,4 +165,12 @@ #include "emu.h" #endif +// Solaris has no dirfd(x) macro or function, and we need one. +// We cannot define macros with arguments directly using AC_DEFINE, +// so do it here instead of in configure.ac. + +#ifndef HAVE_DECL_DIRFD + #define dirfd(x) (x)->d_fd +#endif + #endif // BOXPLATFORM__H |