1#  Copyright 2005 Adam Jackson.
2#
3#  Permission is hereby granted, free of charge, to any person obtaining a
4#  copy of this software and associated documentation files (the "Software"),
5#  to deal in the Software without restriction, including without limitation
6#  on the rights to use, copy, modify, merge, publish, distribute, sub
7#  license, and/or sell copies of the Software, and to permit persons to whom
8#  the Software is furnished to do so, subject to the following conditions:
9#
10#  The above copyright notice and this permission notice (including the next
11#  paragraph) shall be included in all copies or substantial portions of the
12#  Software.
13#
14#  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15#  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16#  FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.  IN NO EVENT SHALL
17#  ADAM JACKSON BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
18#  IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19#  CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20#
21# Process this file with autoconf to produce a configure script
22
23# Initialize Autoconf
24AC_PREREQ([2.60])
25AC_INIT([xf86-video-vmware],
26        [13.4.0],
27        [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
28        [xf86-video-vmware])
29AC_CONFIG_SRCDIR([Makefile.am])
30AC_CONFIG_HEADERS([config.h])
31AC_CONFIG_AUX_DIR(.)
32AC_SYS_LARGEFILE
33
34# Initialize Automake
35AM_INIT_AUTOMAKE([foreign dist-xz])
36
37# Require X.Org macros 1.8 or later for MAN_SUBSTS set by XORG_MANPAGE_SECTIONS
38m4_ifndef([XORG_MACROS_VERSION],
39          [m4_fatal([must install xorg-macros 1.8 or later before running autoconf/autogen])])
40XORG_MACROS_VERSION(1.8)
41XORG_DEFAULT_OPTIONS
42
43# Initialize libtool
44AC_DISABLE_STATIC
45AC_PROG_LIBTOOL
46
47# Checks for programs.
48AM_PROG_CC_C_O
49
50AH_TOP([#include "xorg-server.h"])
51
52# Define a configure option for an alternate module directory
53AC_ARG_WITH(xorg-module-dir,
54            AS_HELP_STRING([--with-xorg-module-dir=DIR],
55                           [Default xorg module directory [[default=$libdir/xorg/modules]]]),
56            [moduledir="$withval"],
57            [moduledir="$libdir/xorg/modules"])
58
59# Define a configure option to build the vmwarectrl client tool
60AC_ARG_ENABLE(vmwarectrl-client,
61              AS_HELP_STRING([--enable-vmwarectrl-client],
62                             [Enable vmwarectrl client (default: disabled)]),
63                             [VMWARECTRL=$enableval], [VMWARECTRL=no])
64AM_CONDITIONAL(BUILD_VMWARECTRL, [test "x$VMWARECTRL" = xyes])
65
66# Store the list of server defined optional extensions in REQUIRED_MODULES
67XORG_DRIVER_CHECK_EXT(RANDR, randrproto)
68XORG_DRIVER_CHECK_EXT(RENDER, renderproto)
69XORG_DRIVER_CHECK_EXT(DPMSExtension, xextproto)
70XORG_DRIVER_CHECK_EXT(XINERAMA, xineramaproto)
71XORG_DRIVER_CHECK_EXT(XV, videoproto)
72
73# Obtain compiler/linker options for the driver dependencies
74PKG_CHECK_MODULES(XORG, [xorg-server >= 1.0.1 xproto fontsproto $REQUIRED_MODULES])
75PKG_CHECK_EXISTS([xorg-server >= 1.1.0],
76                 [AC_DEFINE([HAVE_XORG_SERVER_1_1_0], 1,
77                 [Has version 1.1.0 or greater of the Xserver])])
78
79PKG_CHECK_EXISTS([xorg-server >= 1.2.0],
80                 [AC_DEFINE([HAVE_XORG_SERVER_1_2_0], 1,
81                 [Has version 1.2.0 or greater of the Xserver])])
82
83PKG_CHECK_EXISTS([xorg-server >= 1.4.99],
84                 [AC_DEFINE([HAVE_XORG_SERVER_1_5_0], 1,
85                 [Has version 1.5.0 or greater of the Xserver])])
86
87PKG_CHECK_EXISTS([xorg-server >= 1.7.0],
88                 [AC_DEFINE([HAVE_XORG_SERVER_1_7_0], 1,
89                 [Has version 1.7.0 or greater of the Xserver])
90		 BUILD_VMWGFX=yes],[BUILD_VMWGFX=no])
91
92PKG_CHECK_EXISTS([xorg-server >= 1.12.0],
93                 [AC_DEFINE([HAVE_XORG_SERVER_1_12_0], 1,
94                 [Has version 1.12.0 or greater of the Xserver])])
95
96# Obtain compiler/linker options for the vmwarectrl client tool
97PKG_CHECK_MODULES(X11, x11 xext)
98
99# Checks for libraries.
100
101save_CFLAGS="$CFLAGS"
102CFLAGS="$XORG_CFLAGS"
103AC_CHECK_DECL(XSERVER_LIBPCIACCESS,
104             [XSERVER_LIBPCIACCESS=yes], [XSERVER_LIBPCIACCESS=no],
105             [#include "xorg-server.h"])
106CFLAGS="$save_CFLAGS"
107
108if test x$XSERVER_LIBPCIACCESS = xyes; then
109	PKG_CHECK_MODULES([PCIACCESS], [pciaccess >= 0.8.0])
110fi
111
112AM_CONDITIONAL(XSERVER_LIBPCIACCESS, test "x$XSERVER_LIBPCIACCESS" = xyes)
113
114AC_SUBST([moduledir])
115
116if test x$BUILD_VMWGFX = xyes; then
117	PKG_CHECK_MODULES([LIBDRM], [libdrm],[],[BUILD_VMWGFX=no])
118fi
119if test x$BUILD_VMWGFX = xyes; then
120#
121# Early versions of mesa 10 forgot to bump the XA major version number in
122# the xa_tracker.h header
123#
124	PKG_CHECK_MODULES([XATRACKER], [xatracker >= 0.4.0],
125			  [PKG_CHECK_EXISTS([xatracker = 2.0.0],
126	                  [AC_DEFINE([HAVE_XA_2], 1,
127               		  [Has version 2 of XA])])],
128			  [BUILD_VMWGFX=no])
129#
130# Check for prime.
131#
132	PKG_CHECK_EXISTS([libdrm >= 2.4.38],
133			 [AC_DEFINE([HAVE_LIBDRM_2_4_38], 1,
134			 [Has version 2.4.38 or greater of libdrm])])
135#
136# Check for drmGetDeviceNameFromFd2. On linux we need
137# 2.4.96 for compatibility with the standalone vmwgfx driver
138#
139	PKG_CHECK_EXISTS([libdrm >= 2.4.74],
140			 [AC_DEFINE([HAVE_LIBDRM_2_4_74], 1,
141			 [Has version 2.4.74 or greater of libdrm])])
142	PKG_CHECK_EXISTS([libdrm >= 2.4.96],
143			 [AC_DEFINE([HAVE_LIBDRM_2_4_96], 1,
144			 [Has version 2.4.96 or greater of libdrm])])
145fi
146
147DRIVER_NAME=vmware
148AC_SUBST([DRIVER_NAME])
149
150AC_MSG_CHECKING([whether to build Kernel Mode Setting and 3D])
151if test x$BUILD_VMWGFX = xyes; then
152	AC_MSG_RESULT([yes])
153        AC_DEFINE([BUILD_VMWGFX], 1, [Building the vmwgfx driver path])
154	libudev_check=yes
155	AC_ARG_WITH([libudev],
156		[AS_HELP_STRING([--without-libudev],
157			[Use to build without libudev on linux])],
158			[if test x$withval = xno; then libudev_check=no; fi]
159			[])
160	if test $libudev_check != no; then
161		PKG_CHECK_MODULES(LIBUDEV, [libudev],
162					   [AC_DEFINE([HAVE_LIBUDEV], 1,
163					   [Has libudev installed])],
164					   []);
165        fi
166else
167	AC_MSG_RESULT([no])
168fi
169
170AM_CONDITIONAL(BUILD_VMWGFX, test "x$BUILD_VMWGFX" = xyes)
171
172AC_CONFIG_FILES([
173                Makefile
174                man/Makefile
175                saa/Makefile
176                vmwgfx/Makefile
177                src/Makefile
178                vmwarectrl/Makefile
179])
180
181AC_OUTPUT
182