Upstream-Status: Submitted (http://lists.x.org/archives/xorg-devel/2013-September/037762.html)
Signed-off-by: Ross Burton <ross.burton@intel.com>

From 5ec0aae666feb88d01256cdebbf94a6b373bf4c4 Mon Sep 17 00:00:00 2001
From: Ross Burton <ross.burton@intel.com>
Date: Wed, 11 Sep 2013 21:40:44 +0100
Subject: [PATCH] build: add explicit option to enable/disable VMWGFX

Signed-off-by: Ross Burton <ross.burton@intel.com>
---
 configure.ac |   31 ++++++++++++++-----------------
 1 file changed, 14 insertions(+), 17 deletions(-)

diff --git a/configure.ac b/configure.ac
index 0631bcc..3e14abd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -85,11 +85,6 @@ PKG_CHECK_EXISTS([xorg-server >= 1.4.99],
                  [AC_DEFINE([HAVE_XORG_SERVER_1_5_0], 1,
                  [Has version 1.5.0 or greater of the Xserver])])
 
-PKG_CHECK_EXISTS([xorg-server >= 1.7.0],
-                 [AC_DEFINE([HAVE_XORG_SERVER_1_7_0], 1,
-                 [Has version 1.7.0 or greater of the Xserver])
-		 BUILD_VMWGFX=yes],[BUILD_VMWGFX=no])
-
 PKG_CHECK_EXISTS([xorg-server >= 1.12.0],
                  [AC_DEFINE([HAVE_XORG_SERVER_1_12_0], 1,
                  [Has version 1.12.0 or greater of the Xserver])])
@@ -114,25 +109,27 @@ AM_CONDITIONAL(XSERVER_LIBPCIACCESS, test "x$XSERVER_LIBPCIACCESS" = xyes)
 
 AC_SUBST([moduledir])
 
-if test x$BUILD_VMWGFX = xyes; then
-	PKG_CHECK_MODULES([LIBDRM], [libdrm],[],[BUILD_VMWGFX=no])
-fi
-if test x$BUILD_VMWGFX = xyes; then
-	PKG_CHECK_MODULES([XATRACKER], [xatracker >= 0.4.0],[],[BUILD_VMWGFX=no])
-fi
-
 DRIVER_NAME=vmware
 AC_SUBST([DRIVER_NAME])
 
+AC_ARG_ENABLE(vmwgfx,
+              AS_HELP_STRING([--disable-vmwgfx],
+                             [Disable vmwgfx driver (KMS/3D) (default: enabled)]),
+                             [VMWGFX="$enableval"], [VMWGFX="yes"])
+
 AC_MSG_CHECKING([whether to build Kernel Mode Setting and 3D])
-if test x$BUILD_VMWGFX = xyes; then
-	AC_MSG_RESULT([yes])
+if test "x$VMWGFX" = xyes; then
+        AC_MSG_RESULT([yes])
+        PKG_CHECK_EXISTS([xorg-server >= 1.7.0],
+                         [AC_DEFINE([HAVE_XORG_SERVER_1_7_0], 1,
+                         [Has version 1.7.0 or greater of the Xserver])])
+        PKG_CHECK_MODULES([LIBDRM], [libdrm])
+        PKG_CHECK_MODULES([XATRACKER], [xatracker >= 0.4.0])
         AC_DEFINE([BUILD_VMWGFX], 1, [Building the vmwgfx driver path])
 else
-	AC_MSG_RESULT([no])
+        AC_MSG_RESULT([no])
 fi
-
-AM_CONDITIONAL(BUILD_VMWGFX, test "x$BUILD_VMWGFX" = xyes)
+AM_CONDITIONAL(BUILD_VMWGFX, test "x$VMWGFX" = xyes)
 
 AC_CONFIG_FILES([
                 Makefile
-- 
1.7.10.4

