summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris+github@qwirx.com>2007-12-15 17:02:55 +0000
committerChris Wilson <chris+github@qwirx.com>2007-12-15 17:02:55 +0000
commitd83236f4931ad0184d663ff91e411c071a3304c8 (patch)
tree4b9f7e28987d0ea713ba5682bea25be5ffe43b83
parentf524e66226c1bab18406542d61d6a5f19caa58f2 (diff)
Fix definition of dirfd(x) macro (autoconf doesn't like defining macros
with parameters).
-rw-r--r--configure.ac8
-rw-r--r--lib/common/BoxPlatform.h8
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