1428d7b3dSmrg#  Copyright 2005 Adam Jackson.
2428d7b3dSmrg#
3428d7b3dSmrg#  Permission is hereby granted, free of charge, to any person obtaining a
4428d7b3dSmrg#  copy of this software and associated documentation files (the "Software"),
5428d7b3dSmrg#  to deal in the Software without restriction, including without limitation
6428d7b3dSmrg#  on the rights to use, copy, modify, merge, publish, distribute, sub
7428d7b3dSmrg#  license, and/or sell copies of the Software, and to permit persons to whom
8428d7b3dSmrg#  the Software is furnished to do so, subject to the following conditions:
9428d7b3dSmrg#
10428d7b3dSmrg#  The above copyright notice and this permission notice (including the next
11428d7b3dSmrg#  paragraph) shall be included in all copies or substantial portions of the
12428d7b3dSmrg#  Software.
13428d7b3dSmrg#
14428d7b3dSmrg#  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15428d7b3dSmrg#  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16428d7b3dSmrg#  FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.  IN NO EVENT SHALL
17428d7b3dSmrg#  ADAM JACKSON BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
18428d7b3dSmrg#  IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19428d7b3dSmrg#  CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20428d7b3dSmrg#
21428d7b3dSmrg# Process this file with autoconf to produce a configure script
22428d7b3dSmrg
23428d7b3dSmrg# Initialize Autoconf
24428d7b3dSmrgAC_PREREQ([2.60])
25428d7b3dSmrgAC_INIT([xf86-video-intel],
26428d7b3dSmrg        [2.99.917],
27428d7b3dSmrg        [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
28428d7b3dSmrg        [xf86-video-intel])
29428d7b3dSmrgAC_CONFIG_SRCDIR([Makefile.am])
30428d7b3dSmrgAC_CONFIG_HEADERS([config.h])
31428d7b3dSmrgAC_CONFIG_MACRO_DIR([m4])
32428d7b3dSmrgAC_CONFIG_AUX_DIR(.)
33428d7b3dSmrg
34428d7b3dSmrg# Initialize Automake
35428d7b3dSmrgAM_INIT_AUTOMAKE([foreign dist-bzip2])
36428d7b3dSmrg
37428d7b3dSmrg# Require X.Org macros 1.8 or later for MAN_SUBSTS set by XORG_MANPAGE_SECTIONS
38428d7b3dSmrgm4_ifndef([XORG_MACROS_VERSION],
39428d7b3dSmrg          [m4_fatal([must install xorg-macros 1.8 or later before running autoconf/autogen.
40428d7b3dSmrg  Hint: either install from source, git://anongit.freedesktop.org/xorg/util/macros or,
41428d7b3dSmrg  depending on you distribution, try package 'xutils-dev' or 'xorg-x11-util-macros'])])
42428d7b3dSmrg
43428d7b3dSmrgXORG_MACROS_VERSION(1.8)
44428d7b3dSmrgXORG_DEFAULT_OPTIONS
45428d7b3dSmrg
46428d7b3dSmrg# And disable a few very noisy warnings
47428d7b3dSmrgm4_ifdef([XORG_TESTSET_CFLAG], [
48428d7b3dSmrgXORG_TESTSET_CFLAG([NOWARNFLAGS], [-Wno-cast-qual])
49428d7b3dSmrgXORG_TESTSET_CFLAG([NOWARNFLAGS], [-Wno-redundant-decls])
50428d7b3dSmrgXORG_TESTSET_CFLAG([NOWARNFLAGS], [-Wno-maybe-uninitialized])
51428d7b3dSmrg])
52428d7b3dSmrgAC_SUBST(NOWARNFLAGS)
53428d7b3dSmrg
54428d7b3dSmrg# Require X.Org server macros (i.e. XORG_DRIVER_CHECK_EXT) to check for required modules 
55428d7b3dSmrgm4_ifndef([XORG_DRIVER_CHECK_EXT],
56428d7b3dSmrg          [m4_fatal([must install xorg-server macros before running autoconf/autogen.
57428d7b3dSmrg  Hint: either install from source, git://anongit.freedesktop.org/xorg/xserver or,
58428d7b3dSmrg  depending on your distribution, try package 'xserver-xorg-dev' or 'xorg-x11-server-devel'])])
59428d7b3dSmrg
60428d7b3dSmrg# Initialize libtool
61428d7b3dSmrgAC_DISABLE_STATIC
62428d7b3dSmrgAC_PROG_LIBTOOL
63428d7b3dSmrgAC_SYS_LARGEFILE
64428d7b3dSmrg
65428d7b3dSmrg# Check for common libc routines redefined by os.h
66428d7b3dSmrgAC_CHECK_FUNCS([strlcpy strlcat strndup], [], [])
67428d7b3dSmrg
68428d7b3dSmrg# Platform specific settings
69428d7b3dSmrgcase $host_os in
70428d7b3dSmrg  *linux*)
71428d7b3dSmrg    backlight_helper=yes
72428d7b3dSmrg    ;;
73428d7b3dSmrgesac
74428d7b3dSmrg
75428d7b3dSmrgAC_ARG_ENABLE(backlight,
76428d7b3dSmrg              AS_HELP_STRING([--disable-backlight],
77428d7b3dSmrg			     [Enable control over the backlight [default=yes]]),
78428d7b3dSmrg              [backlight="$enableval"],
79428d7b3dSmrg              [backlight="yes"])
80428d7b3dSmrgif test "x$backlight" = "xyes"; then
81428d7b3dSmrg	AC_DEFINE(USE_BACKLIGHT, 1, [Enable control of the backlight])
82428d7b3dSmrgfi
83428d7b3dSmrg
84428d7b3dSmrgAC_ARG_ENABLE(backlight-helper,
85428d7b3dSmrg              AS_HELP_STRING([--disable-backlight-helper],
86428d7b3dSmrg			     [Enable building the backlight helper executable for running X under a normal user [default=auto]]),
87428d7b3dSmrg              [backlight_helper="$enableval"],)
88428d7b3dSmrgAM_CONDITIONAL(BUILD_BACKLIGHT_HELPER, [test "x$backlight" = "xyes" -a "x$backlight_helper" = "xyes"])
89428d7b3dSmrgif test "x$backlight_helper" = "xyes"; then
90428d7b3dSmrg	tools_msg="$tools_msg xf86-video-intel-backlight-helper"
91428d7b3dSmrg	AC_DEFINE(USE_BACKLIGHT_HELPER, 1, [Enable use of the backlight helper interfaces])
92428d7b3dSmrgfi
93428d7b3dSmrg
94428d7b3dSmrg# Are we in a git checkout?
95428d7b3dSmrgdot_git=no
96428d7b3dSmrgif test -e .git; then
97428d7b3dSmrg	AC_DEFINE(HAVE_DOT_GIT, 1, [Are we in a git checkout?])
98428d7b3dSmrg	dot_git=yes
99428d7b3dSmrgfi
100428d7b3dSmrgAM_CONDITIONAL(HAVE_DOT_GIT, test "x$dot_git" = "xyes")
101428d7b3dSmrg
102428d7b3dSmrg# If so, we include the git description in our logs for sanity checking.
103428d7b3dSmrg#
104428d7b3dSmrg# However, for people not running their own drivers this is just noise.
105428d7b3dSmrg# So we copy the xserver's builderstring idiom to allow for this to be
106428d7b3dSmrg# overridden and perhaps replaced with something more useful.
107428d7b3dSmrgAC_ARG_WITH(builderstring,
108428d7b3dSmrg	    AS_HELP_STRING([--with-builderstring=BUILDERSTRING],
109428d7b3dSmrg			   [Additional builder string (default: use git describe)]),
110428d7b3dSmrg	    [BUILDERSTRING="$withval"],
111428d7b3dSmrg	    [BUILDERSTRING="x-magic-git-describe"])
112428d7b3dSmrg
113428d7b3dSmrgif test "x$BUILDERSTRING" = "xx-magic-git-describe" -a "x$dot_git" = "xyes"; then
114428d7b3dSmrg	AC_DEFINE(USE_GIT_DESCRIBE, 1, [Use automagic builder description])
115428d7b3dSmrgelse
116428d7b3dSmrg  if test "x$BUILDERSTRING" != x -a "x$BUILDERSTRING" != "xno" -a "x$BUILDERSTRING" != xx-magic-git-describe; then
117428d7b3dSmrg	  AC_DEFINE_UNQUOTED(BUILDER_DESCRIPTION, ["$BUILDERSTRING"], [Builder description])
118428d7b3dSmrg  fi
119428d7b3dSmrgfi
120428d7b3dSmrg
121428d7b3dSmrgAC_ARG_ENABLE(gen4asm,
122428d7b3dSmrg              AS_HELP_STRING([--enable-gen4asm],
123428d7b3dSmrg			     [Enable rebuilding the gen4 assembly files [default=no]]),
124428d7b3dSmrg              [ASM="$enableval"],
125428d7b3dSmrg              [ASM="no"])
126428d7b3dSmrg
127428d7b3dSmrggen4asm=no
128428d7b3dSmrgif test "x$ASM" != "xno"; then
129428d7b3dSmrg	AC_ARG_WITH(gen4asm,
130428d7b3dSmrg		    AS_HELP_STRING([--with-gen4asm=PATH],
131428d7b3dSmrg				   [Path to intel-gen4asm binary]),
132428d7b3dSmrg		    [path="$withval"],
133428d7b3dSmrg		    [path=""])
134428d7b3dSmrg	if test -n "$path" ; then
135428d7b3dSmrg		gen4asm=yes
136428d7b3dSmrg	else
137428d7b3dSmrg		PKG_CHECK_MODULES(GEN4ASM, [intel-gen4asm >= 1.2], [gen4asm=yes], [gen4asm=no])
138428d7b3dSmrg		if test "x$ASM" = "xyes" -a "x$gen4asm" != "xyes"; then
139428d7b3dSmrg			AC_MSG_ERROR([intel-gen4asm support requested but not found])
140428d7b3dSmrg		fi
141428d7b3dSmrg	fi
142428d7b3dSmrg	if test "x$gen4asm" = "xyes"; then
143428d7b3dSmrg		AC_MSG_CHECKING([path to use for intel-gen4asm])
144428d7b3dSmrg		if test -n "$path" ; then
145428d7b3dSmrg			INTEL_GEN4ASM="$path"
146428d7b3dSmrg		else
147428d7b3dSmrg			INTEL_GEN4ASM="`pkg-config intel-gen4asm --variable=exec_prefix`/bin/intel-gen4asm"
148428d7b3dSmrg		fi
149428d7b3dSmrg		if ! test -e "$INTEL_GEN4ASM"; then
150428d7b3dSmrg			AC_MSG_ERROR([intel-gen4asm enabled, but not found. Tried '$INTEL_GEN4ASM'.])
151428d7b3dSmrg		fi
152428d7b3dSmrg		AC_MSG_RESULT([$INTEL_GEN4ASM])
153428d7b3dSmrg		AC_SUBST([INTEL_GEN4ASM])
154428d7b3dSmrg	fi
155428d7b3dSmrgfi
156428d7b3dSmrgAM_CONDITIONAL(HAVE_GEN4ASM, test "x$gen4asm" = "xyes")
157428d7b3dSmrg
158428d7b3dSmrg# Check for atomic intrinsics
159428d7b3dSmrgAC_CACHE_CHECK([for native atomic primitives], intel_cv_atomic_primitives,
160428d7b3dSmrg[
161428d7b3dSmrg    intel_cv_atomic_primitives="none"
162428d7b3dSmrg
163428d7b3dSmrg    AC_LINK_IFELSE([AC_LANG_PROGRAM([[
164428d7b3dSmrgint atomic_add(int i) { return __sync_fetch_and_add (&i, 1); }
165428d7b3dSmrgint atomic_cmpxchg(int i, int j, int k) { return __sync_val_compare_and_swap (&i, j, k); }
166428d7b3dSmrg				    ]],[[]])],
167428d7b3dSmrg		   [intel_cv_atomic_primitives="Intel"],[])
168428d7b3dSmrg
169428d7b3dSmrg    if test "x$intel_cv_atomic_primitives" = "xnone"; then
170428d7b3dSmrg	    AC_CHECK_HEADER([atomic_ops.h], intel_cv_atomic_primitives="libatomic-ops")
171428d7b3dSmrg    fi
172428d7b3dSmrg
173428d7b3dSmrg    # atomic functions defined in <atomic.h> & libc on Solaris
174428d7b3dSmrg    if test "x$intel_cv_atomic_primitives" = "xnone"; then
175428d7b3dSmrg	    AC_CHECK_FUNC([atomic_cas_uint],
176428d7b3dSmrg			  intel_cv_atomic_primitives="Solaris")
177428d7b3dSmrg    fi
178428d7b3dSmrg
179428d7b3dSmrg])
180428d7b3dSmrgif test "x$intel_cv_atomic_primitives" = "xIntel"; then
181428d7b3dSmrg    AC_DEFINE(HAVE_ATOMIC_PRIMITIVES, 1,
182428d7b3dSmrg	      [Enable if your compiler supports the Intel __sync_* atomic primitives])
183428d7b3dSmrgfi
184428d7b3dSmrgif test "x$intel_cv_atomic_primitives" = "xlibatomic-ops"; then
185428d7b3dSmrg    AC_DEFINE(HAVE_LIB_ATOMIC_OPS, 1, [Enable if you have libatomic-ops-dev installed])
186428d7b3dSmrgfi
187428d7b3dSmrg
188428d7b3dSmrgif test "x$intel_cv_atomic_primitives" = "xnone"; then
189428d7b3dSmrg		AC_MSG_ERROR([xf86-video-intel depends upon atomic operations, which were not found for your compiler/cpu. Try compiling with -march=native, or install the libatomics-op-dev package.])
190428d7b3dSmrgfi
191428d7b3dSmrg
192428d7b3dSmrgAC_ARG_ENABLE(udev,
193428d7b3dSmrg              AS_HELP_STRING([--disable-udev],
194428d7b3dSmrg                             [Disable udev-based monitor hotplug detection [default=auto]]),
195428d7b3dSmrg              [UDEV="$enableval"],
196428d7b3dSmrg              [UDEV=auto])
197428d7b3dSmrg
198428d7b3dSmrgif test "x$UDEV" != "xno"; then
199428d7b3dSmrg	PKG_CHECK_MODULES(UDEV, [libudev], [udev="yes"], [udev="no"])
200428d7b3dSmrg	if test "x$UDEV" = "xyes" -a "x$udev" != "xyes"; then
201428d7b3dSmrg		AC_MSG_ERROR([udev support requested but not found (libudev)])
202428d7b3dSmrg	fi
203428d7b3dSmrg	if test "x$udev" = "xyes"; then
204428d7b3dSmrg		AC_DEFINE(HAVE_UDEV,1,[Enable udev-based monitor hotplug detection])
205428d7b3dSmrg	fi
206428d7b3dSmrgfi
207428d7b3dSmrg
208428d7b3dSmrgPKG_CHECK_MODULES(X11, [x11 xrender xrandr xext xfixes cairo cairo-xlib-xrender pixman-1 libpng], [x11="yes"], [x11="no"])
209428d7b3dSmrgAM_CONDITIONAL(HAVE_X11, test "x$x11" = "xyes")
210428d7b3dSmrg
211428d7b3dSmrgcpuid="yes"
212428d7b3dSmrgAC_TRY_LINK([
213428d7b3dSmrg	#include <cpuid.h>
214428d7b3dSmrg	#include <stddef.h>
215428d7b3dSmrg	],
216428d7b3dSmrg	[
217428d7b3dSmrg	int eax, ebx, ecx, edx;
218428d7b3dSmrg	if (__get_cpuid_max(0, NULL) < 4)
219428d7b3dSmrg		return 0;
220428d7b3dSmrg	__cpuid_count(4, 0, eax, ebx, ecx, edx);
221428d7b3dSmrg	],
222428d7b3dSmrg	[cpuid="yes"],
223428d7b3dSmrg	[cpuid="no"]
224428d7b3dSmrg)
225428d7b3dSmrgif test "x$cpuid" = "xyes"; then
226428d7b3dSmrg	AC_DEFINE(HAVE_CPUID_H,1,[Found a useable cpuid.h])
227428d7b3dSmrgfi
228428d7b3dSmrg
229428d7b3dSmrgshm=yes
230428d7b3dSmrgAC_CHECK_HEADERS([sys/ipc.h sys/ipc.h], [], [shm="no"])
231428d7b3dSmrgAC_CHECK_HEADERS([X11/extensions/XShm.h], [], [shm="no"], [
232428d7b3dSmrg#include <X11/Xlibint.h>
233428d7b3dSmrg#include <X11/Xproto.h>
234428d7b3dSmrg])
235428d7b3dSmrgAC_CHECK_HEADERS([X11/extensions/shmproto.h X11/extensions/shmstr.h], [], [], [
236428d7b3dSmrg#include <X11/Xlibint.h>
237428d7b3dSmrg#include <X11/Xproto.h>
238428d7b3dSmrg])
239428d7b3dSmrgif test "x$ac_cv_header_X11_extensions_shmproto_h" != "xyes" -a "x$ac_cv_header_X11_extensions_shmstr_h" != "xyes"; then
240428d7b3dSmrg	shm="no"
241428d7b3dSmrgfi
242428d7b3dSmrg
243428d7b3dSmrgif test "x$shm" = "xyes"; then
244428d7b3dSmrg	AC_MSG_CHECKING(whether shmctl IPC_RMID allows subsequent attaches)
245428d7b3dSmrg	AC_TRY_RUN([
246428d7b3dSmrg		  #include <sys/types.h>
247428d7b3dSmrg		  #include <sys/ipc.h>
248428d7b3dSmrg		  #include <sys/shm.h>
249428d7b3dSmrg		  int main()
250428d7b3dSmrg		  {
251428d7b3dSmrg		      char *shmaddr;
252428d7b3dSmrg		      int id = shmget (IPC_PRIVATE, 4, IPC_CREAT | 0600);
253428d7b3dSmrg		      if (id == -1) return 2;
254428d7b3dSmrg		      shmaddr = shmat (id, 0, 0);
255428d7b3dSmrg		      shmctl (id, IPC_RMID, 0);
256428d7b3dSmrg		      if ((char*) shmat (id, 0, 0) == (char*) -1) {
257428d7b3dSmrg			  shmdt (shmaddr);
258428d7b3dSmrg			  return 1;
259428d7b3dSmrg		      }
260428d7b3dSmrg		      shmdt (shmaddr);
261428d7b3dSmrg		      shmdt (shmaddr);
262428d7b3dSmrg		      return 0;
263428d7b3dSmrg		  }
264428d7b3dSmrg		  ],
265428d7b3dSmrg		  AC_DEFINE(IPC_RMID_DEFERRED_RELEASE, 1,
266428d7b3dSmrg			    [Define to 1 if shared memory segments are released deferred.])
267428d7b3dSmrg		  AC_MSG_RESULT(yes),
268428d7b3dSmrg		  AC_MSG_RESULT(no),
269428d7b3dSmrg		  AC_MSG_RESULT(assuming no))
270428d7b3dSmrg	AC_DEFINE([HAVE_MIT_SHM], 1, [Define to 1 if MIT-SHM is available])
271428d7b3dSmrgfi
272428d7b3dSmrg
273428d7b3dSmrgPKG_CHECK_MODULES(X11_DRI3, [xcb-dri3 xcb-sync xcb-present x11-xcb xshmfence x11 xrender xext libdrm], [x11_dri3="yes"], [x11_dri3="no"])
274428d7b3dSmrgAM_CONDITIONAL(X11_DRI3, test "x$x11_dri3" = "xyes" -a "x$shm" = "xyes")
275428d7b3dSmrgAM_CONDITIONAL(X11_SHM, test "x$shm" = "xyes")
276428d7b3dSmrg
277428d7b3dSmrgAC_ARG_ENABLE(tools,
278428d7b3dSmrg              AS_HELP_STRING([--disable-tools],
279428d7b3dSmrg			     [Enable building and installing the miscellaneous tools [default=auto]]),
280428d7b3dSmrg              [tools="$enableval"], [tools="auto"])
281428d7b3dSmrgif test "x$shm" != "xyes"; then
282428d7b3dSmrg	if test "x$tools" = "xyes"; then
283428d7b3dSmrg		AC_MSG_ERROR([Incomplete requirements for extra tools, X11 MIT-SHM extension required])
284428d7b3dSmrg	fi
285428d7b3dSmrg	tools="no"
286428d7b3dSmrgfi
287428d7b3dSmrgif test "x$tools" != "xno"; then
288428d7b3dSmrg	ivo_requires="xrandr xdamage xfixes xcursor xtst xrender xext x11 pixman-1"
289428d7b3dSmrg	extra_cflags=""
290428d7b3dSmrg
291428d7b3dSmrg	ignore="xinerama"
292428d7b3dSmrg	PKG_CHECK_MODULES(IVO_EXTRA, [$ignore],
293428d7b3dSmrg			  [AC_CHECK_HEADERS([X11/extensions/Xinerama.h], [ivo_requires="$ignore $ivo_requires"], [],
294428d7b3dSmrg					    [#include <X11/Xlibint.h>
295428d7b3dSmrg					     #include <X11/Xproto.h>
296428d7b3dSmrg					    ])], [ignore=""])
297428d7b3dSmrg
298428d7b3dSmrg	ignore="xcb-dri3 xcb-sync x11-xcb xshmfence x11"
299428d7b3dSmrg	PKG_CHECK_MODULES(IVO_EXTRA, [$ignore], [ivo_requires="$ivo_requires $ignore"; extra_cflags="-DDRI3"], [ignore=""])
300428d7b3dSmrg
301428d7b3dSmrg	PKG_CHECK_MODULES(IVO, [$ivo_requires], [ivo="yes"], [ivo="no"])
302428d7b3dSmrg	AC_CHECK_HEADER([sys/timerfd.h], [], [ivo="no"])
303428d7b3dSmrg	if test "x$ivo" = "xno"; then
304428d7b3dSmrg		if test "x$tools" = "xyes"; then
305428d7b3dSmrg			AC_MSG_ERROR([Incomplete requirements for intel-virtual-output, requires $ivo_requires])
306428d7b3dSmrg		fi
307428d7b3dSmrg		tools="no"
308428d7b3dSmrg	fi
309428d7b3dSmrg
310428d7b3dSmrg	IVO_CFLAGS="$IVO_CFLAGS $extra_cflags"
311428d7b3dSmrgfi
312428d7b3dSmrgif test "x$tools" != "xno"; then
313428d7b3dSmrg      tools_msg="$tools_msg intel-virtual-output"
314428d7b3dSmrgfi
315428d7b3dSmrgAC_MSG_CHECKING([whether to build additional tools])
316428d7b3dSmrgAC_MSG_RESULT([$tools])
317428d7b3dSmrgAM_CONDITIONAL(BUILD_TOOLS, test "x$tools" != "xno")
318428d7b3dSmrg
319428d7b3dSmrg# Define a configure option for an alternate module directory
320428d7b3dSmrgAC_ARG_WITH(xorg-module-dir,
321428d7b3dSmrg            AS_HELP_STRING([--with-xorg-module-dir=DIR],
322428d7b3dSmrg                           [Default xorg module directory [[default=$libdir/xorg/modules]]]),
323428d7b3dSmrg            [moduledir="$withval"],
324428d7b3dSmrg            [moduledir="$libdir/xorg/modules"])
325428d7b3dSmrg
326428d7b3dSmrgAC_ARG_ENABLE(dri,
327428d7b3dSmrg	      AS_HELP_STRING([--disable-dri],
328428d7b3dSmrg			     [Disable DRI support [[default=auto]]]),
329428d7b3dSmrg	      [DRI=$enableval],
330428d7b3dSmrg	      [DRI=auto])
331428d7b3dSmrgAC_ARG_ENABLE(dri1,
332428d7b3dSmrg	      AS_HELP_STRING([--disable-dri1],
333428d7b3dSmrg			     [Disable DRI1 support [[default=yes]]]),
334428d7b3dSmrg	      [DRI1=$enableval],
335428d7b3dSmrg	      [DRI1=yes])
336428d7b3dSmrgAC_ARG_ENABLE(dri2,
337428d7b3dSmrg	      AS_HELP_STRING([--disable-dri2],
338428d7b3dSmrg			     [Disable DRI2 support [[default=yes]]]),
339428d7b3dSmrg	      [DRI2=$enableval],
340428d7b3dSmrg	      [DRI2=yes])
341428d7b3dSmrgAC_ARG_ENABLE(dri3,
342428d7b3dSmrg	      AS_HELP_STRING([--enable-dri3],
343428d7b3dSmrg			     [Enable DRI3 support [[default=no]]]),
344428d7b3dSmrg	      [DRI3=$enableval],
345428d7b3dSmrg	      [DRI3=no])
346428d7b3dSmrg
347428d7b3dSmrgAC_ARG_ENABLE(xvmc, AS_HELP_STRING([--disable-xvmc],
348428d7b3dSmrg                                  [Disable XvMC support [[default=yes]]]),
349428d7b3dSmrg              [XVMC="$enableval"],
350428d7b3dSmrg              [XVMC="yes"])
351428d7b3dSmrg
352428d7b3dSmrgAC_ARG_ENABLE(kms,
353428d7b3dSmrg	      AS_HELP_STRING([--enable-kms],
354428d7b3dSmrg			     [Assume KMS support [[default=yes]]]),
355428d7b3dSmrg              [KMS="$enableval"],
356428d7b3dSmrg              [KMS="yes"])
357428d7b3dSmrgAC_ARG_ENABLE(ums,
358428d7b3dSmrg	      AS_HELP_STRING([--enable-ums],
359428d7b3dSmrg			     [Assume UMS support [[default=auto]]]),
360428d7b3dSmrg              [UMS="$enableval"],
361428d7b3dSmrg              [UMS="auto"])
362428d7b3dSmrg
363428d7b3dSmrgAC_ARG_ENABLE(kms-only,
364428d7b3dSmrg	      AS_HELP_STRING([--enable-kms-only],
365428d7b3dSmrg			     [Only assume KMS support (no UMS) [[default=no]]]),
366428d7b3dSmrg              [ONLY_KMS="$enableval"],
367428d7b3dSmrg              [ONLY_KMS="no"])
368428d7b3dSmrg
369428d7b3dSmrgAC_ARG_ENABLE(ums-only,
370428d7b3dSmrg	      AS_HELP_STRING([--enable-ums-only],
371428d7b3dSmrg			     [Only assume UMS support (no KMS) [[default=no]]]),
372428d7b3dSmrg              [ONLY_UMS="$enableval"],
373428d7b3dSmrg              [ONLY_UMS="no"])
374428d7b3dSmrg
375428d7b3dSmrgrequired_xorg_server_version=1.6
376428d7b3dSmrgrequired_pixman_version=0.16
377428d7b3dSmrg
378428d7b3dSmrgif pkg-config --exists 'pixman-1 >= 0.27.1'; then
379428d7b3dSmrg	AC_DEFINE([HAS_PIXMAN_GLYPHS], 1, [Enable pixman glyph cache])
380428d7b3dSmrgfi
381428d7b3dSmrg
382428d7b3dSmrgif pkg-config --exists 'pixman-1 >= 0.24.0'; then
383428d7b3dSmrg	AC_DEFINE([HAS_PIXMAN_TRIANGLES], 1, [Enable pixman triangle rasterisation])
384428d7b3dSmrgfi
385428d7b3dSmrg
386428d7b3dSmrg# Store the list of server defined optional extensions in REQUIRED_MODULES
387428d7b3dSmrgXORG_DRIVER_CHECK_EXT(RANDR, randrproto)
388428d7b3dSmrgXORG_DRIVER_CHECK_EXT(RENDER, renderproto)
389428d7b3dSmrgXORG_DRIVER_CHECK_EXT(DPMSExtension, xextproto)
390428d7b3dSmrg
391428d7b3dSmrg# Obtain compiler/linker options for the driver dependencies
392428d7b3dSmrgPKG_CHECK_MODULES(DRM, [libdrm >= 2.4.20]) # libdrm_intel is checked separately
393428d7b3dSmrgPKG_CHECK_MODULES(PCIACCESS, [pciaccess >= 0.10])
394428d7b3dSmrg
395428d7b3dSmrgAC_ARG_ENABLE(sna,
396428d7b3dSmrg	      AS_HELP_STRING([--enable-sna],
397428d7b3dSmrg			     [Enable SandyBridge\'s New Acceleration (SNA) [default=auto]]),
398428d7b3dSmrg	      [SNA="$enableval"],
399428d7b3dSmrg	      [SNA=auto])
400428d7b3dSmrg
401428d7b3dSmrgif test "x$SNA" != "xno"; then
402428d7b3dSmrg	AC_DEFINE(USE_SNA, 1, [Enable SNA support])
403428d7b3dSmrg	AC_CHECK_HEADERS([sys/sysinfo.h], AC_CHECK_MEMBERS([struct sysinfo.totalram], [], [], [[#include <sys/sysinfo.h>]]))
404428d7b3dSmrgfi
405428d7b3dSmrg
406428d7b3dSmrguxa_requires_libdrm=2.4.52
407428d7b3dSmrgAC_ARG_ENABLE(uxa,
408428d7b3dSmrg	      AS_HELP_STRING([--enable-uxa],
409428d7b3dSmrg			     [Enable Unified Acceleration Architecture (UXA) [default=auto]]),
410428d7b3dSmrg	      [UXA="$enableval"],
411428d7b3dSmrg	      [UXA=auto])
412428d7b3dSmrgif test "x$UXA" = "xauto"; then
413428d7b3dSmrg	if ! pkg-config --exists "libdrm_intel >= $uxa_requires_libdrm"; then
414428d7b3dSmrg		UXA=no
415428d7b3dSmrg	fi
416428d7b3dSmrg	if ! pkg-config --exists 'pixman-1 >= 0.24.0'; then
417428d7b3dSmrg		UXA=no
418428d7b3dSmrg	fi
419428d7b3dSmrgfi
420428d7b3dSmrgif test "x$UXA" != "xno"; then
421428d7b3dSmrg	AC_DEFINE(USE_UXA, 1, [Enable UXA support])
422428d7b3dSmrg	PKG_CHECK_MODULES(DRMINTEL, [libdrm_intel >= $uxa_requires_libdrm])
423428d7b3dSmrg	required_pixman_version=0.24
424428d7b3dSmrg	UXA=yes
425428d7b3dSmrgfi
426428d7b3dSmrg
427428d7b3dSmrgPKG_CHECK_MODULES(XORG, [xorg-server >= $required_xorg_server_version xproto fontsproto pixman-1 >= $required_pixman_version $REQUIRED_MODULES])
428428d7b3dSmrgABI_VERSION=`$PKG_CONFIG --variable=abi_videodrv xorg-server`
429428d7b3dSmrg
430428d7b3dSmrgif test "x$ONLY_UMS" = "xyes"; then
431428d7b3dSmrg	UMS="yes"
432428d7b3dSmrg	KMS="no"
433428d7b3dSmrgfi
434428d7b3dSmrg
435428d7b3dSmrgif test "x$ONLY_KMS" = "xyes"; then
436428d7b3dSmrg	UMS="no"
437428d7b3dSmrg	KMS="yes"
438428d7b3dSmrgfi
439428d7b3dSmrg
440428d7b3dSmrgsave_CPPFLAGS=$CPPFLAGS
441428d7b3dSmrgCPPFLAGS=$XORG_CFLAGS
442428d7b3dSmrgAC_CHECK_HEADERS([vgaHW.h], legacy="yes", legacy="no")
443428d7b3dSmrgCPPFLAGS=$save_CPPFLAGS
444428d7b3dSmrgif test "x$UMS" = "xauto"; then
445428d7b3dSmrg	UMS="$legacy"
446428d7b3dSmrgfi
447428d7b3dSmrgif test "x$UMS" = "xyes" -a "x$legacy" = "xno"; then
448428d7b3dSmrg	AC_MSG_ERROR([vgaHW support required for UMS (i810) driver])
449428d7b3dSmrgfi
450428d7b3dSmrg
451428d7b3dSmrgif test "x$UMS" = "xyes"; then
452428d7b3dSmrg	AC_ARG_ENABLE(xaa,
453428d7b3dSmrg		      AS_HELP_STRING([--enable-xaa],
454428d7b3dSmrg				     [Enable legacy X Acceleration Architecture (XAA) for i810 chipsets [default=auto]]),
455428d7b3dSmrg		      [XAA="$enableval"],
456428d7b3dSmrg		      [XAA="auto"])
457428d7b3dSmrg	if test "x$XAA" != "xno"; then
458428d7b3dSmrg		save_CPPFLAGS=$CPPFLAGS
459428d7b3dSmrg		CPPFLAGS=$XORG_CFLAGS
460428d7b3dSmrg		AC_CHECK_HEADERS([xaa.h], XAA="yes", XAA="no")
461428d7b3dSmrg		CPPFLAGS=$save_CPPFLAGS
462428d7b3dSmrg	fi
463428d7b3dSmrg	AC_MSG_CHECKING([whether to include XAA support])
464428d7b3dSmrg	AC_MSG_RESULT([$XAA])
465428d7b3dSmrg
466428d7b3dSmrg	AC_ARG_ENABLE(dga,
467428d7b3dSmrg		      AS_HELP_STRING([--enable-dga],
468428d7b3dSmrg				     [Enable legacy Direct Graphics Access (DGA) for i810 chipsets [default=auto]]),
469428d7b3dSmrg		      [DGA="$enableval"],
470428d7b3dSmrg		      [DGA="auto"])
471428d7b3dSmrg	if test "x$DGA" != "xno"; then
472428d7b3dSmrg		save_CFLAGS=$CFLAGS
473428d7b3dSmrg		CFLAGS=$XORG_CFLAGS
474428d7b3dSmrg		AC_CHECK_HEADERS([dgaproc.h], DGA="yes", DGA="no", [#include <dixstruct.h>])
475428d7b3dSmrg		CFLAGS=$save_CFLAGS
476428d7b3dSmrg	fi
477428d7b3dSmrg	AC_MSG_CHECKING([whether to include DGA support])
478428d7b3dSmrg	AC_MSG_RESULT([$DGA])
479428d7b3dSmrgfi
480428d7b3dSmrgAM_CONDITIONAL(DGA, test "x$DGA" = "xyes")
481428d7b3dSmrgAM_CONDITIONAL(XAA, test "x$XAA" = "xyes")
482428d7b3dSmrg
483428d7b3dSmrgAM_CONDITIONAL(KMS, test "x$KMS" = "xyes")
484428d7b3dSmrgif test "x$KMS" = "xyes"; then
485428d7b3dSmrg	AC_DEFINE(KMS,1,[Assume KMS support])
486428d7b3dSmrgfi
487428d7b3dSmrgAM_CONDITIONAL(UMS, test "x$UMS" = "xyes")
488428d7b3dSmrgif test "x$UMS" = "xyes"; then
489428d7b3dSmrg	AC_DEFINE(UMS,1,[Assume UMS support])
490428d7b3dSmrgfi
491428d7b3dSmrg
492428d7b3dSmrghave_dri1=no
493428d7b3dSmrgXORG_DRIVER_CHECK_EXT(XF86DRI, xf86driproto)
494428d7b3dSmrgif test "x$_EXT_CHECK" != "xno" -a "x$DRI" != "xno" -a "x$DRI1" != "xno" -a "x$UMS" = "xyes"; then
495428d7b3dSmrg	PKG_CHECK_MODULES(DRI1, [xf86driproto], [have_dri1=$DRI], [have_dri1=no])
496428d7b3dSmrg        save_CFLAGS="$CFLAGS"
497428d7b3dSmrg        save_CPPFLAGS="$CPPFLAGS"
498428d7b3dSmrg        CFLAGS="$CFLAGS $XORG_CFLAGS $DRI1_CFLAGS $DRM_CFLAGS"
499428d7b3dSmrg        CPPFLAGS="$CPPFLAGS $XORG_CFLAGS $DRI1_CFLAGS $DRM_CFLAGS"
500428d7b3dSmrg        AC_CHECK_HEADERS([dri.h sarea.h dristruct.h], [], [have_dri1=no],
501428d7b3dSmrg                [/* for dri.h */
502428d7b3dSmrg                 #include <xf86str.h>
503428d7b3dSmrg                 /* for dristruct.h */
504428d7b3dSmrg                 #include <xorg-server.h>
505428d7b3dSmrg                 #ifdef HAVE_DRI_H
506428d7b3dSmrg                 # include <dri.h>
507428d7b3dSmrg                 #endif
508428d7b3dSmrg                 #ifdef HAVE_SAREA_H
509428d7b3dSmrg                 # include <sarea.h>
510428d7b3dSmrg                 #endif
511428d7b3dSmrg                ])
512428d7b3dSmrg        CFLAGS="$save_CFLAGS"
513428d7b3dSmrg        CPPFLAGS="$save_CPPFLAGS"
514428d7b3dSmrgfi
515428d7b3dSmrg
516428d7b3dSmrgAC_MSG_CHECKING([whether to include DRI1 support])
517428d7b3dSmrgAC_MSG_RESULT([$have_dri1])
518428d7b3dSmrg
519428d7b3dSmrgAM_CONDITIONAL(DRI1, test "x$have_dri1" != "xno")
520428d7b3dSmrgif test "x$have_dri1" != "xno"; then
521428d7b3dSmrg        AC_DEFINE(HAVE_DRI1,1,[Enable DRI1 driver support])
522428d7b3dSmrg	dri_msg="$dri_msg DRI1"
523428d7b3dSmrgelse
524428d7b3dSmrg        DRI1_CFLAGS=""
525428d7b3dSmrg        DRI1_LIBS=""
526428d7b3dSmrg
527428d7b3dSmrg        if test "x$DRI" = "xyes" -a "x$UMS" = "xyes" -a "x$DRI1" != "xno"; then
528428d7b3dSmrg                AC_MSG_ERROR([DRI1 requested but prerequisites not found])
529428d7b3dSmrg        fi
530428d7b3dSmrgfi
531428d7b3dSmrg
532428d7b3dSmrghave_dri2=no
533428d7b3dSmrghave_dri3=no
534428d7b3dSmrgif test "x$DRI" != "xno"; then
535428d7b3dSmrg	if test "x$DRI2" != "xno"; then
536428d7b3dSmrg		PKG_CHECK_MODULES(DRI2, [dri2proto >= 2.6], [have_dri2=$DRI], [have_dri2=no])
537428d7b3dSmrg	fi
538428d7b3dSmrg	if test "x$have_dri2" != "xno"; then
539428d7b3dSmrg		save_CFLAGS=$CFLAGS
540428d7b3dSmrg		CFLAGS="$XORG_CFLAGS $DRM_CFLAGS $DRI1_CFLAGS $DRI2_CFLAGS"
541428d7b3dSmrg		AC_CHECK_HEADERS([dri2.h], [], [have_dri2=no], [
542428d7b3dSmrg#include <dixstruct.h>
543428d7b3dSmrg#include <drm.h>
544428d7b3dSmrg])
545428d7b3dSmrg		CFLAGS=$save_CFLAGS
546428d7b3dSmrg	fi
547428d7b3dSmrg	if test "x$have_dri2" != "xno"; then
548428d7b3dSmrg		dridriverdir=`$PKG_CONFIG --variable=dridriverdir dri`
549428d7b3dSmrg		if test "x$dridriverdir" = "x"; then
550428d7b3dSmrg			dridriverdir="$libdir/dri"
551428d7b3dSmrg		fi
552428d7b3dSmrg		AC_DEFINE_DIR(DRI_DRIVER_PATH, dridriverdir, [Default have_dri2 driver path])
553428d7b3dSmrg	fi
554428d7b3dSmrg
555428d7b3dSmrg	if test "x$DRI3" != "xno"; then
556428d7b3dSmrg		XORG_DRIVER_CHECK_EXT(DRI3, dri3proto)
557428d7b3dSmrg		if test "x$_EXT_CHECK" != "xno"; then
558428d7b3dSmrg			PKG_CHECK_MODULES(DRI3, [dri3proto], [have_dri3=$DRI], [])
559428d7b3dSmrg		fi
560428d7b3dSmrg	fi
561428d7b3dSmrg	if test "x$have_dri3" != "xno"; then
562428d7b3dSmrg		save_CFLAGS=$CFLAGS
563428d7b3dSmrg		CFLAGS="$XORG_CFLAGS $DRI3_CFLAGS"
564428d7b3dSmrg		AC_CHECK_DECL(DRI3, [], [have_dri3=no], [#include <xorg-server.h>])
565428d7b3dSmrg		AC_CHECK_HEADERS([misyncstr.h misyncshm.h], [], [have_dri3=no], [
566428d7b3dSmrg#include <xorg-server.h>
567428d7b3dSmrg#include <xf86str.h>
568428d7b3dSmrg#include <misync.h>
569428d7b3dSmrg])
570428d7b3dSmrg		CFLAGS=$save_CFLAGS
571428d7b3dSmrg	fi
572428d7b3dSmrgfi
573428d7b3dSmrg
574428d7b3dSmrgAC_MSG_CHECKING([whether to include DRI2 support])
575428d7b3dSmrgAM_CONDITIONAL(DRI2, test "x$have_dri2" != "xno")
576428d7b3dSmrgAC_MSG_RESULT([$have_dri2])
577428d7b3dSmrgif test "x$have_dri2" != "xno"; then
578428d7b3dSmrg        AC_DEFINE(HAVE_DRI2,1,[Enable DRI2 driver support])
579428d7b3dSmrg	dri_msg="$dri_msg DRI2"
580428d7b3dSmrgelse
581428d7b3dSmrg	if test "x$DRI" = "xyes" -a "x$DRI2" != "xno" -a "x$KMS" = "xyes"; then
582428d7b3dSmrg		AC_MSG_ERROR([DRI2 requested but prerequisites not found])
583428d7b3dSmrg	fi
584428d7b3dSmrg
585428d7b3dSmrg	# UXA doesn't build without DRI2 headers, too late to fix
586428d7b3dSmrg	UXA=no
587428d7b3dSmrgfi
588428d7b3dSmrg
589428d7b3dSmrgAC_MSG_CHECKING([whether to include DRI3 support])
590428d7b3dSmrgAM_CONDITIONAL(DRI3, test "x$have_dri3" != "xno")
591428d7b3dSmrgAC_MSG_RESULT([$have_dri3])
592428d7b3dSmrgif test "x$have_dri3" != "xno"; then
593428d7b3dSmrg        AC_DEFINE(HAVE_DRI3,1,[Enable DRI3 driver support])
594428d7b3dSmrg	dri_msg="$dri_msg DRI3"
595428d7b3dSmrgelse
596428d7b3dSmrg	if test "x$DRI" = "xyes" -a "x$DRI3" != "xno" -a "x$KMS" = "xyes"; then
597428d7b3dSmrg		AC_MSG_ERROR([DRI3 requested but prerequisites not found])
598428d7b3dSmrg	fi
599428d7b3dSmrgfi
600428d7b3dSmrg
601428d7b3dSmrgAC_CHECK_HEADERS([X11/extensions/dpmsconst.h])
602428d7b3dSmrg
603428d7b3dSmrgPRESENT="no"
604428d7b3dSmrgXORG_DRIVER_CHECK_EXT(PRESENT, presentproto)
605428d7b3dSmrgif test "x$_EXT_CHECK" != "xno"; then
606428d7b3dSmrg	PKG_CHECK_MODULES(PRESENT, [presentproto], [PRESENT="yes"], [])
607428d7b3dSmrgfi
608428d7b3dSmrgif test "x$PRESENT" != "xno"; then
609428d7b3dSmrg	save_CFLAGS=$CFLAGS
610428d7b3dSmrg	CFLAGS="$XORG_CFLAGS $PRESENT_CFLAGS"
611428d7b3dSmrg	AC_CHECK_HEADERS([present.h], [], [PRESENT="no"], [
612428d7b3dSmrg#include <xorg-server.h>
613428d7b3dSmrg#include <xf86str.h>
614428d7b3dSmrg])
615428d7b3dSmrg	CFLAGS=$save_CFLAGS
616428d7b3dSmrgfi
617428d7b3dSmrgAC_MSG_CHECKING([whether to include PRESENT support])
618428d7b3dSmrgAM_CONDITIONAL(PRESENT, test "x$PRESENT" != "xno")
619428d7b3dSmrgAC_MSG_RESULT([$PRESENT])
620428d7b3dSmrgif test "x$PRESENT" != "xno"; then
621428d7b3dSmrg        AC_DEFINE(HAVE_PRESENT,1,[Enable PRESENT driver support])
622428d7b3dSmrg	dri_msg="$dri_msg Present"
623428d7b3dSmrgfi
624428d7b3dSmrg
625428d7b3dSmrgAC_MSG_CHECKING([whether to include UXA support])
626428d7b3dSmrgAC_MSG_RESULT([$UXA])
627428d7b3dSmrgAM_CONDITIONAL(UXA, test "x$UXA" != "xno")
628428d7b3dSmrg
629428d7b3dSmrgAC_MSG_CHECKING([whether to include SNA support])
630428d7b3dSmrgAM_CONDITIONAL(SNA, test "x$SNA" != "xno")
631428d7b3dSmrgAC_MSG_RESULT([$SNA])
632428d7b3dSmrg
633428d7b3dSmrgif test "$XVMC" = "yes"; then
634428d7b3dSmrg	PKG_CHECK_MODULES(XVMCLIB, [xvmc dri2proto x11 x11-xcb xcb-dri2 xcb-aux libdrm_intel], [], [XVMC="no"])
635428d7b3dSmrgfi
636428d7b3dSmrgAC_MSG_CHECKING([whether to include XvMC support])
637428d7b3dSmrgAC_MSG_RESULT([$XVMC])
638428d7b3dSmrgAM_CONDITIONAL(XVMC, test "x$XVMC" = "xyes")
639428d7b3dSmrgif test "x$XVMC" = "xyes"; then
640428d7b3dSmrg	AC_DEFINE(ENABLE_XVMC,1,[Enable XvMC support])
641428d7b3dSmrg	xvmc_msg=" yes"
642428d7b3dSmrgelse
643428d7b3dSmrg	xvmc_msg=" no"
644428d7b3dSmrgfi
645428d7b3dSmrg
646428d7b3dSmrg
647428d7b3dSmrgAC_ARG_WITH(default-accel,
648428d7b3dSmrg	    AS_HELP_STRING([--with-default-accel],
649428d7b3dSmrg			   [Select the default acceleration method out of none, sna, or uxa  [default is sna if enabled, otherwise uxa]]),
650428d7b3dSmrg			   [accel="$withval"],
651428d7b3dSmrg			   [accel="auto"])
652428d7b3dSmrgif test "x$accel" = "xyes"; then
653428d7b3dSmrg	AC_MSG_WARN([No default acceleration specified, choosing automatic selection])
654428d7b3dSmrg	accel="auto"
655428d7b3dSmrgfi
656428d7b3dSmrg
657428d7b3dSmrgAC_MSG_CHECKING([which acceleration method to use by default])
658428d7b3dSmrgif test "x$accel" = "xauto"; then
659428d7b3dSmrg	if test "x$SNA" != "xno"; then
660428d7b3dSmrg		accel="sna"
661428d7b3dSmrg	else
662428d7b3dSmrg		if test "x$UXA" != "xno"; then
663428d7b3dSmrg			accel="uxa"
664428d7b3dSmrg		fi
665428d7b3dSmrg	fi
666428d7b3dSmrg	if test "x$accel" = "xauto" -a "x$KMS" = "xyes"; then
667428d7b3dSmrg		AC_MSG_ERROR([No default acceleration option])
668428d7b3dSmrg	fi
669428d7b3dSmrgfi
670428d7b3dSmrg
671428d7b3dSmrghave_accel="none"
672428d7b3dSmrgif test "x$accel" = "xsna"; then
673428d7b3dSmrg	if test "x$SNA" != "xno"; then
674428d7b3dSmrg		AC_DEFINE(DEFAULT_ACCEL_METHOD, SNA, [Default acceleration method])
675428d7b3dSmrg		have_accel="yes"
676428d7b3dSmrg	else
677428d7b3dSmrg		AC_MSG_ERROR([SNA requested as default, but is not enabled])
678428d7b3dSmrg	fi
679428d7b3dSmrgfi
680428d7b3dSmrg
681428d7b3dSmrgif test "x$accel" = "xuxa"; then
682428d7b3dSmrg	if test "x$UXA" != "xno"; then
683428d7b3dSmrg		AC_DEFINE(DEFAULT_ACCEL_METHOD, UXA, [Default acceleration method])
684428d7b3dSmrg		have_accel="yes"
685428d7b3dSmrg	else
686428d7b3dSmrg		AC_MSG_ERROR([UXA requested as default, but is not enabled])
687428d7b3dSmrg	fi
688428d7b3dSmrgfi
689428d7b3dSmrg
690428d7b3dSmrgif test "x$have_accel" = "xnone"; then
691428d7b3dSmrg	if test "x$KMS" = "xyes"; then
692428d7b3dSmrg		if test "x$SNA" != "xno" -o "x$UXA" != "xno"; then
693428d7b3dSmrg			AC_DEFINE(DEFAULT_ACCEL_METHOD, NOACCEL, [Default acceleration method])
694428d7b3dSmrg		else
695428d7b3dSmrg			AC_MSG_ERROR([Invalid default acceleration option])
696428d7b3dSmrg		fi
697428d7b3dSmrg	fi
698428d7b3dSmrg	accel="none"
699428d7b3dSmrgfi
700428d7b3dSmrgAC_MSG_RESULT($accel)
701428d7b3dSmrg
702428d7b3dSmrgxp_msg=""
703428d7b3dSmrg
704428d7b3dSmrgAC_ARG_ENABLE(tear-free,
705428d7b3dSmrg	      AS_HELP_STRING([--enable-tear-free],
706428d7b3dSmrg			     [Enable use of TearFree by default [default=no]]),
707428d7b3dSmrg	      [TEARFREE="$enableval"],
708428d7b3dSmrg	      [TEARFREE="no"])
709428d7b3dSmrgif test "x$TEARFREE" = "xyes"; then
710428d7b3dSmrg	AC_DEFINE(TEARFREE,1,[Enable "TearFree" by default])
711428d7b3dSmrg	xp_msg="$xp_msg TearFree"
712428d7b3dSmrgfi
713428d7b3dSmrg
714428d7b3dSmrgAC_ARG_ENABLE(rendernode,
715428d7b3dSmrg	      AS_HELP_STRING([--enable-rendernode],
716428d7b3dSmrg			     [Enable use of render nodes (experimental) [default=no]]),
717428d7b3dSmrg	      [RENDERNODE="$enableval"],
718428d7b3dSmrg	      [RENDERNODE="no"])
719428d7b3dSmrgAM_CONDITIONAL(USE_RENDERNODE, test "x$RENDERNODE" = "xyes")
720428d7b3dSmrgif test "x$RENDERNODE" = "xyes"; then
721428d7b3dSmrg	AC_DEFINE(USE_RENDERNODE,1,[Assume "rendernode" support])
722428d7b3dSmrg	xp_msg="$xp_msg rendernode"
723428d7b3dSmrgfi
724428d7b3dSmrg
725428d7b3dSmrgAC_ARG_ENABLE(wc-mmap,
726428d7b3dSmrg	      AS_HELP_STRING([--enable-wc-mmap],
727428d7b3dSmrg			     [Enable use of WriteCombining mmaps [default=no]]),
728428d7b3dSmrg	      [WC_MMAP="$enableval"],
729428d7b3dSmrg	      [WC_MMAP="no"])
730428d7b3dSmrgif test "x$WC_MMAP" = "xyes"; then
731428d7b3dSmrg	AC_DEFINE(USE_WC_MMAP,1,[Enable use of WriteCombining mmaps])
732428d7b3dSmrg	xp_msg="$xp_msg mmap(wc)"
733428d7b3dSmrgfi
734428d7b3dSmrg
735428d7b3dSmrgAC_ARG_ENABLE(create2,
736428d7b3dSmrg	      AS_HELP_STRING([--enable-create2],
737428d7b3dSmrg			     [Enable use of create2 ioctl (experimental) [default=no]]),
738428d7b3dSmrg	      [CREATE2="$enableval"],
739428d7b3dSmrg	      [CREATE2="no"])
740428d7b3dSmrgAM_CONDITIONAL(USE_CREATE2, test "x$CREATE2" = "xyes")
741428d7b3dSmrgif test "x$CREATE2" = "xyes"; then
742428d7b3dSmrg	AC_DEFINE(USE_CREATE2,1,[Assume "create2" support])
743428d7b3dSmrg	xp_msg="$xp_msg create2"
744428d7b3dSmrgfi
745428d7b3dSmrg
746428d7b3dSmrgAC_ARG_ENABLE(async-swap,
747428d7b3dSmrg	      AS_HELP_STRING([--enable-async-swap],
748428d7b3dSmrg			     [Enable use of asynchronous swaps (experimental) [default=no]]),
749428d7b3dSmrg	      [ASYNC_SWAP="$enableval"],
750428d7b3dSmrg	      [ASYNC_SWAP="no"])
751428d7b3dSmrgAM_CONDITIONAL(USE_ASYNC_SWAP, test "x$ASYNC_SWAP" = "xyes")
752428d7b3dSmrgif test "x$ASYNC_SWAP" = "xyes"; then
753428d7b3dSmrg	AC_DEFINE(USE_ASYNC_SWAP,1,[Assume asynchronous swap support])
754428d7b3dSmrg	xp_msg="$xp_msg async-swap"
755428d7b3dSmrgfi
756428d7b3dSmrg
757428d7b3dSmrgAC_ARG_ENABLE(debug,
758428d7b3dSmrg	      AS_HELP_STRING([--enable-debug],
759428d7b3dSmrg			     [Enables internal debugging [default=no]]),
760428d7b3dSmrg              [DEBUG="$enableval"],
761428d7b3dSmrg              [DEBUG="no"])
762428d7b3dSmrgAC_ARG_ENABLE(valgrind,
763428d7b3dSmrg	      AS_HELP_STRING([--enable-valgrind],
764428d7b3dSmrg			     [Enables valgrindified ioctls for debugging [default=no]]),
765428d7b3dSmrg              [VG="$enableval"],
766428d7b3dSmrg              [VG="no"])
767428d7b3dSmrg
768428d7b3dSmrgLIBS=""
769428d7b3dSmrgAC_SEARCH_LIBS(clock_gettime, rt, [CLOCK_GETTIME_LIBS=$LIBS])
770428d7b3dSmrgAC_SUBST(CLOCK_GETTIME_LIBS)
771428d7b3dSmrg
772428d7b3dSmrgsdkdir=`$PKG_CONFIG --variable=sdkdir xorg-server`
773428d7b3dSmrg
774428d7b3dSmrgAM_CONDITIONAL(DEBUG, test "x$DEBUG" != "xno")
775428d7b3dSmrgAM_CONDITIONAL(FULL_DEBUG, test "x$DEBUG" = "xfull")
776428d7b3dSmrgif test "x$DEBUG" = "xno"; then
777428d7b3dSmrg	AC_DEFINE(NDEBUG,1,[Disable internal debugging])
778428d7b3dSmrgelse
779428d7b3dSmrg	if test "x$VG" != "xyes"; then
780428d7b3dSmrg		VG=auto
781428d7b3dSmrg	fi
782428d7b3dSmrgfi
783428d7b3dSmrgdebug_msg=""
784428d7b3dSmrghave_valgrind="no"
785428d7b3dSmrgif test "x$VG" != "xno"; then
786428d7b3dSmrg	PKG_CHECK_MODULES(VALGRIND, [valgrind], have_valgrind="yes", have_valgrind="no")
787428d7b3dSmrg	AC_MSG_CHECKING([whether to include valgrind support])
788428d7b3dSmrg	if test "x$have_valgrind" = "xyes"; then
789428d7b3dSmrg		AC_DEFINE([HAVE_VALGRIND], 1, [Use valgrind intrinsics to suppress false warnings])
790428d7b3dSmrg	else
791428d7b3dSmrg		if test "x$VG" = "xyes"; then
792428d7b3dSmrg			AC_MSG_ERROR([valgrind support requested, but valgrind-dev headers not found])
793428d7b3dSmrg		fi
794428d7b3dSmrg	fi
795428d7b3dSmrg	AC_MSG_RESULT([$have_valgrind ($VG)])
796428d7b3dSmrgfi
797428d7b3dSmrgAM_CONDITIONAL(VALGRIND, test "x$have_valgrind" = "xyes")
798428d7b3dSmrgif test "x$have_valgrind" = "xyes"; then
799428d7b3dSmrg	debug_msg="$debug_msg valgrind"
800428d7b3dSmrgfi
801428d7b3dSmrgif test "x$DEBUG" = "xsync"; then
802428d7b3dSmrg	AC_DEFINE(DEBUG_SYNC,1,[Enable synchronous rendering for debugging])
803428d7b3dSmrg	debug_msg="$debug_msg sync"
804428d7b3dSmrgfi
805428d7b3dSmrgif test "x$DEBUG" = "xmemory"; then
806428d7b3dSmrg	AC_DEFINE(DEBUG_MEMORY,1,[Enable memory debugging])
807428d7b3dSmrg	debug_msg="$debug_msg memory"
808428d7b3dSmrgfi
809428d7b3dSmrgif test "x$DEBUG" = "xpixmap"; then
810428d7b3dSmrg	AC_DEFINE(DEBUG_PIXMAP,1,[Enable pixmap debugging])
811428d7b3dSmrg	debug_msg="$debug_msg pixmaps"
812428d7b3dSmrgfi
813428d7b3dSmrgif test "x$DEBUG" = "xfull"; then
814428d7b3dSmrg	AC_DEFINE(DEBUG_MEMORY,1,[Enable memory debugging])
815428d7b3dSmrg	AC_DEFINE(DEBUG_PIXMAP,1,[Enable pixmap debugging])
816428d7b3dSmrg	AC_DEFINE(HAS_DEBUG_FULL,1,[Enable all debugging])
817428d7b3dSmrg        CFLAGS="$CFLAGS -O0 -ggdb3"
818428d7b3dSmrg	debug_msg=" full"
819428d7b3dSmrgfi
820428d7b3dSmrgif test "x$debug_msg" = "x"; then
821428d7b3dSmrg	debug_msg=" none"
822428d7b3dSmrgfi
823428d7b3dSmrg
824428d7b3dSmrgAC_CONFIG_LIBOBJ_DIR(libobj)
825428d7b3dSmrgAC_REPLACE_FUNCS(getline)
826428d7b3dSmrg
827428d7b3dSmrgDRIVER_NAME="intel"
828428d7b3dSmrgAC_SUBST([DRIVER_NAME])
829428d7b3dSmrgAC_SUBST([moduledir])
830428d7b3dSmrgAC_DEFINE_DIR([PREFIX_PATH], prefix, [installation prefix])
831428d7b3dSmrgAC_DEFINE_DIR([LIBEXEC_PATH], libexecdir, [libexec directory])
832428d7b3dSmrg
833428d7b3dSmrgAC_CONFIG_FILES([
834428d7b3dSmrg                Makefile
835428d7b3dSmrg                man/Makefile
836428d7b3dSmrg		libobj/Makefile
837428d7b3dSmrg                src/Makefile
838428d7b3dSmrg                src/legacy/Makefile
839428d7b3dSmrg                src/legacy/i810/Makefile
840428d7b3dSmrg                src/legacy/i810/xvmc/Makefile
841428d7b3dSmrg                src/render_program/Makefile
842428d7b3dSmrg                src/sna/Makefile
843428d7b3dSmrg                src/sna/brw/Makefile
844428d7b3dSmrg                src/sna/fb/Makefile
845428d7b3dSmrg                src/uxa/Makefile
846428d7b3dSmrg                xvmc/Makefile
847428d7b3dSmrg                xvmc/shader/Makefile
848428d7b3dSmrg                xvmc/shader/mc/Makefile
849428d7b3dSmrg                xvmc/shader/vld/Makefile
850428d7b3dSmrg		test/Makefile
851428d7b3dSmrg		tools/Makefile
852428d7b3dSmrg		tools/org.x.xf86-video-intel.backlight-helper.policy
853428d7b3dSmrg])
854428d7b3dSmrgAC_OUTPUT
855428d7b3dSmrg
856428d7b3dSmrgecho ""
857428d7b3dSmrgecho ""
858428d7b3dSmrgtest -e `pwd $0`/README && cat `pwd $0`/README
859428d7b3dSmrg
860428d7b3dSmrgaccel_msg=""
861428d7b3dSmrgif test "x$SNA" != "xno"; then
862428d7b3dSmrg	if test "$accel" = "none"; then
863428d7b3dSmrg		accel_msg="$accel_msg *none"
864428d7b3dSmrg	else
865428d7b3dSmrg		accel_msg="$accel_msg none"
866428d7b3dSmrg	fi
867428d7b3dSmrg	if test "$accel" = "sna"; then
868428d7b3dSmrg		accel_msg="$accel_msg *sna"
869428d7b3dSmrg	else
870428d7b3dSmrg		accel_msg="$accel_msg sna"
871428d7b3dSmrg	fi
872428d7b3dSmrgfi
873428d7b3dSmrgif test "x$UXA" != "xno"; then
874428d7b3dSmrg	if test "x$SNA" = "xno"; then
875428d7b3dSmrg		if test "$accel" = "none"; then
876428d7b3dSmrg			accel_msg="$accel_msg *none"
877428d7b3dSmrg		else
878428d7b3dSmrg			accel_msg="$accel_msg none"
879428d7b3dSmrg		fi
880428d7b3dSmrg	fi
881428d7b3dSmrg	if test "$accel" = "uxa"; then
882428d7b3dSmrg		accel_msg="$accel_msg *uxa"
883428d7b3dSmrg	else
884428d7b3dSmrg		accel_msg="$accel_msg uxa"
885428d7b3dSmrg	fi
886428d7b3dSmrgfi
887428d7b3dSmrg
888428d7b3dSmrgif test "x$dri_msg" = "x"; then
889428d7b3dSmrg	dri_msg=" none"
890428d7b3dSmrgfi
891428d7b3dSmrg
892428d7b3dSmrgif test "x$tools_msg" = "x"; then
893428d7b3dSmrg	tools_msg=" none"
894428d7b3dSmrgfi
895428d7b3dSmrg
896428d7b3dSmrgecho ""
897428d7b3dSmrgecho "AC_PACKAGE_STRING will be compiled with:"
898428d7b3dSmrgecho "  Xorg Video ABI version: $ABI_VERSION"
899428d7b3dSmrgecho "  Acceleration backends:$accel_msg"
900428d7b3dSmrgecho "  Additional debugging support?$debug_msg"
901428d7b3dSmrgecho "  Support for Kernel Mode Setting? $KMS"
902428d7b3dSmrgecho "  Support for legacy User Mode Setting (for i810)? $UMS"
903428d7b3dSmrgecho "  Support for Direct Rendering Infrastructure:$dri_msg"
904428d7b3dSmrgecho "  Support for Xv motion compensation (XvMC and libXvMC):$xvmc_msg"
905428d7b3dSmrgecho "  Build additional tools and utilities?$tools_msg"
906428d7b3dSmrgif test -n "$xp_msg"; then
907428d7b3dSmrgecho "  Experimental support:$xp_msg"
908428d7b3dSmrgfi
909428d7b3dSmrgecho ""
910