summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Hellstrom <thellstrom@vmware.com>2015-04-08 18:25:41 +0200
committerThomas Hellstrom <thellstrom@vmware.com>2015-04-08 22:58:47 -0700
commit5b7d9cf15ae44361a3de506916f769d8dfec61d1 (patch)
treeaf533c0b4c172b9f420de32c159f00e641e8fcb1
parentc8ec00f537a640db049a1afb44a31c2199859085 (diff)
vmmouse: Fix vmmouse_detect build on BSD
Tested with FreeBSD, but changes affect also OpenBSD and NetBSD to fix compiling and linking with the relevant system libraries. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Brian Paul <brianp@vmware.com> Acked-by: Sinclair Yeh <syeh@vmware.com>
-rw-r--r--configure.ac31
-rw-r--r--tools/vmmouse_iopl.c9
2 files changed, 37 insertions, 3 deletions
diff --git a/configure.ac b/configure.ac
index 212f083..248fde9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -148,6 +148,37 @@ case $host_os in
;;
esac
+case $host_cpu in
+ i*86)
+ case $host_os in
+ *freebsd*) AC_DEFINE(USE_DEV_IO) ;;
+ *netbsd*) AC_DEFINE(USE_I386_IOPL)
+ use_i386_iopl=yes ;;
+ *openbsd*) AC_DEFINE(USE_I386_IOPL)
+ use_i386_iopl=yes ;;
+ esac
+ ;;
+ x86_64*|amd64*)
+ case $host_os in
+ *freebsd*) AC_DEFINE(USE_DEV_IO, 1, [BSD /dev/io]) ;;
+ *netbsd*) AC_DEFINE(USE_I386_IOPL, 1, [BSD i386 iopl])
+ use_i386_iopl=yes ;;
+ *openbsd*) AC_DEFINE(USE_AMD64_IOPL, 1, [BSD AMD64 iopl])
+ use_amd64_iopl=yes ;;
+ esac
+ ;;
+esac
+
+if test x$use_i386_iopl = xyes; then
+ AC_CHECK_LIB(i386, i386_iopl,[],
+ [AC_MSG_ERROR([cannot find library for i386_iopl])])
+fi
+
+if test x$use_amd64_iopl = xyes; then
+ AC_CHECK_LIB(amd64, amd64_iopl,[],
+ [AC_MSG_ERROR([cannot find library for amd64_iopl])])
+fi
+
PKG_CHECK_MODULES(XORG, [xorg-server >= 1.0.1] xproto $REQUIRED_MODULES)
PKG_CHECK_EXISTS([xorg-server >= 1.1.0],
diff --git a/tools/vmmouse_iopl.c b/tools/vmmouse_iopl.c
index 3b3fc0b..8794622 100644
--- a/tools/vmmouse_iopl.c
+++ b/tools/vmmouse_iopl.c
@@ -43,10 +43,9 @@
#include <stdbool.h>
#if defined(VMMOUSE_OS_BSD)
-#define HAVE_WRAPPER_DECLS
-#include "xf86_OSlib.h"
-#include "xf86OSpriv.h"
+#include <sys/types.h>
#ifdef USE_I386_IOPL
+#include <machine/sysarch.h>
/***************************************************************************/
/* I/O Permissions section */
/***************************************************************************/
@@ -80,6 +79,7 @@ xf86DisableIO()
#endif /* USE_I386_IOPL */
#ifdef USE_AMD64_IOPL
+#include <machine/sysarch.h>
/***************************************************************************/
/* I/O Permissions section */
/***************************************************************************/
@@ -114,6 +114,9 @@ xf86DisableIO()
#endif /* USE_AMD64_IOPL */
#ifdef USE_DEV_IO
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
static int IoFd = -1;
bool