18c7da7f0Smrg#  Copyright 2005 Adam Jackson.
28c7da7f0Smrg#
38c7da7f0Smrg#  Permission is hereby granted, free of charge, to any person obtaining a
48c7da7f0Smrg#  copy of this software and associated documentation files (the "Software"),
58c7da7f0Smrg#  to deal in the Software without restriction, including without limitation
68c7da7f0Smrg#  on the rights to use, copy, modify, merge, publish, distribute, sub
78c7da7f0Smrg#  license, and/or sell copies of the Software, and to permit persons to whom
88c7da7f0Smrg#  the Software is furnished to do so, subject to the following conditions:
98c7da7f0Smrg#
108c7da7f0Smrg#  The above copyright notice and this permission notice (including the next
118c7da7f0Smrg#  paragraph) shall be included in all copies or substantial portions of the
128c7da7f0Smrg#  Software.
138c7da7f0Smrg#
148c7da7f0Smrg#  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
158c7da7f0Smrg#  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
168c7da7f0Smrg#  FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.  IN NO EVENT SHALL
178c7da7f0Smrg#  ADAM JACKSON BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
188c7da7f0Smrg#  IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
198c7da7f0Smrg#  CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
208c7da7f0Smrg#
218c7da7f0Smrg# Process this file with autoconf to produce a configure script
228c7da7f0Smrg
2303b705cfSriastradh# Initialize Autoconf
2403b705cfSriastradhAC_PREREQ([2.60])
258c7da7f0SmrgAC_INIT([xf86-video-intel],
2613496ba1Ssnj        [2.99.917],
278c7da7f0Smrg        [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
2803b705cfSriastradh        [xf86-video-intel])
298c7da7f0SmrgAC_CONFIG_SRCDIR([Makefile.am])
3003b705cfSriastradhAC_CONFIG_HEADERS([config.h])
3103b705cfSriastradhAC_CONFIG_MACRO_DIR([m4])
328c7da7f0SmrgAC_CONFIG_AUX_DIR(.)
338c7da7f0Smrg
3403b705cfSriastradh# Initialize Automake
3503b705cfSriastradhAM_INIT_AUTOMAKE([foreign dist-bzip2])
3603b705cfSriastradh
3703b705cfSriastradh# Require X.Org macros 1.8 or later for MAN_SUBSTS set by XORG_MANPAGE_SECTIONS
3803b705cfSriastradhm4_ifndef([XORG_MACROS_VERSION],
3903b705cfSriastradh          [m4_fatal([must install xorg-macros 1.8 or later before running autoconf/autogen.
4003b705cfSriastradh  Hint: either install from source, git://anongit.freedesktop.org/xorg/util/macros or,
4103b705cfSriastradh  depending on you distribution, try package 'xutils-dev' or 'xorg-x11-util-macros'])])
428c7da7f0Smrg
4303b705cfSriastradhXORG_MACROS_VERSION(1.8)
4403b705cfSriastradhXORG_DEFAULT_OPTIONS
4503b705cfSriastradh
4603b705cfSriastradh# And disable a few very noisy warnings
4703b705cfSriastradhm4_ifdef([XORG_TESTSET_CFLAG], [
4803b705cfSriastradhXORG_TESTSET_CFLAG([NOWARNFLAGS], [-Wno-cast-qual])
4903b705cfSriastradhXORG_TESTSET_CFLAG([NOWARNFLAGS], [-Wno-redundant-decls])
5003b705cfSriastradhXORG_TESTSET_CFLAG([NOWARNFLAGS], [-Wno-maybe-uninitialized])
5103b705cfSriastradh])
5203b705cfSriastradhAC_SUBST(NOWARNFLAGS)
538c7da7f0Smrg
5403b705cfSriastradh# Require X.Org server macros (i.e. XORG_DRIVER_CHECK_EXT) to check for required modules 
5503b705cfSriastradhm4_ifndef([XORG_DRIVER_CHECK_EXT],
5603b705cfSriastradh          [m4_fatal([must install xorg-server macros before running autoconf/autogen.
5703b705cfSriastradh  Hint: either install from source, git://anongit.freedesktop.org/xorg/xserver or,
5803b705cfSriastradh  depending on your distribution, try package 'xserver-xorg-dev' or 'xorg-x11-server-devel'])])
5903b705cfSriastradh
6003b705cfSriastradh# Initialize libtool
618c7da7f0SmrgAC_DISABLE_STATIC
628c7da7f0SmrgAC_PROG_LIBTOOL
6303b705cfSriastradhAC_SYS_LARGEFILE
6403b705cfSriastradh
6542542f5fSchristos# Check for common libc routines redefined by os.h
6642542f5fSchristosAC_CHECK_FUNCS([strlcpy strlcat strndup], [], [])
6742542f5fSchristos
6842542f5fSchristos# Platform specific settings
6942542f5fSchristoscase $host_os in
7042542f5fSchristos  *linux*)
7142542f5fSchristos    backlight_helper=yes
7242542f5fSchristos    ;;
7342542f5fSchristosesac
7442542f5fSchristos
7542542f5fSchristosAC_ARG_ENABLE(backlight,
7642542f5fSchristos              AS_HELP_STRING([--disable-backlight],
7742542f5fSchristos			     [Enable control over the backlight [default=yes]]),
7842542f5fSchristos              [backlight="$enableval"],
7942542f5fSchristos              [backlight="yes"])
8042542f5fSchristosif test "x$backlight" = "xyes"; then
8142542f5fSchristos	AC_DEFINE(USE_BACKLIGHT, 1, [Enable control of the backlight])
8242542f5fSchristosfi
8342542f5fSchristos
8442542f5fSchristosAC_ARG_ENABLE(backlight-helper,
8542542f5fSchristos              AS_HELP_STRING([--disable-backlight-helper],
8642542f5fSchristos			     [Enable building the backlight helper executable for running X under a normal user [default=auto]]),
8742542f5fSchristos              [backlight_helper="$enableval"],)
8842542f5fSchristosAM_CONDITIONAL(BUILD_BACKLIGHT_HELPER, [test "x$backlight" = "xyes" -a "x$backlight_helper" = "xyes"])
8942542f5fSchristosif test "x$backlight_helper" = "xyes"; then
9042542f5fSchristos	tools_msg="$tools_msg xf86-video-intel-backlight-helper"
9142542f5fSchristos	AC_DEFINE(USE_BACKLIGHT_HELPER, 1, [Enable use of the backlight helper interfaces])
9242542f5fSchristosfi
9342542f5fSchristos
9403b705cfSriastradh# Are we in a git checkout?
9503b705cfSriastradhdot_git=no
9603b705cfSriastradhif test -e .git; then
9703b705cfSriastradh	AC_DEFINE(HAVE_DOT_GIT, 1, [Are we in a git checkout?])
9803b705cfSriastradh	dot_git=yes
9903b705cfSriastradhfi
10042542f5fSchristosAM_CONDITIONAL(HAVE_DOT_GIT, test "x$dot_git" = "xyes")
1018c7da7f0Smrg
10203b705cfSriastradh# If so, we include the git description in our logs for sanity checking.
10303b705cfSriastradh#
10403b705cfSriastradh# However, for people not running their own drivers this is just noise.
10503b705cfSriastradh# So we copy the xserver's builderstring idiom to allow for this to be
10603b705cfSriastradh# overridden and perhaps replaced with something more useful.
10703b705cfSriastradhAC_ARG_WITH(builderstring,
10803b705cfSriastradh	    AS_HELP_STRING([--with-builderstring=BUILDERSTRING],
10903b705cfSriastradh			   [Additional builder string (default: use git describe)]),
11003b705cfSriastradh	    [BUILDERSTRING="$withval"],
11103b705cfSriastradh	    [BUILDERSTRING="x-magic-git-describe"])
11203b705cfSriastradh
11342542f5fSchristosif test "x$BUILDERSTRING" = "xx-magic-git-describe" -a "x$dot_git" = "xyes"; then
11403b705cfSriastradh	AC_DEFINE(USE_GIT_DESCRIBE, 1, [Use automagic builder description])
11503b705cfSriastradhelse
11642542f5fSchristos  if test "x$BUILDERSTRING" != x -a "x$BUILDERSTRING" != "xno" -a "x$BUILDERSTRING" != xx-magic-git-describe; then
11703b705cfSriastradh	  AC_DEFINE_UNQUOTED(BUILDER_DESCRIPTION, ["$BUILDERSTRING"], [Builder description])
11803b705cfSriastradh  fi
11903b705cfSriastradhfi
12003b705cfSriastradh
12103b705cfSriastradhAC_ARG_ENABLE(gen4asm,
12203b705cfSriastradh              AS_HELP_STRING([--enable-gen4asm],
12303b705cfSriastradh			     [Enable rebuilding the gen4 assembly files [default=no]]),
12403b705cfSriastradh              [ASM="$enableval"],
12542542f5fSchristos              [ASM="no"])
12603b705cfSriastradh
12703b705cfSriastradhgen4asm=no
12842542f5fSchristosif test "x$ASM" != "xno"; then
12942542f5fSchristos	AC_ARG_WITH(gen4asm,
13042542f5fSchristos		    AS_HELP_STRING([--with-gen4asm=PATH],
13142542f5fSchristos				   [Path to intel-gen4asm binary]),
13242542f5fSchristos		    [path="$withval"],
13342542f5fSchristos		    [path=""])
13442542f5fSchristos	if test -n "$path" ; then
13542542f5fSchristos		gen4asm=yes
13642542f5fSchristos	else
13742542f5fSchristos		PKG_CHECK_MODULES(GEN4ASM, [intel-gen4asm >= 1.2], [gen4asm=yes], [gen4asm=no])
13842542f5fSchristos		if test "x$ASM" = "xyes" -a "x$gen4asm" != "xyes"; then
13942542f5fSchristos			AC_MSG_ERROR([intel-gen4asm support requested but not found])
14042542f5fSchristos		fi
14103b705cfSriastradh	fi
14242542f5fSchristos	if test "x$gen4asm" = "xyes"; then
14303b705cfSriastradh		AC_MSG_CHECKING([path to use for intel-gen4asm])
14442542f5fSchristos		if test -n "$path" ; then
14542542f5fSchristos			INTEL_GEN4ASM="$path"
14642542f5fSchristos		else
14742542f5fSchristos			INTEL_GEN4ASM="`pkg-config intel-gen4asm --variable=exec_prefix`/bin/intel-gen4asm"
14842542f5fSchristos		fi
14903b705cfSriastradh		if ! test -e "$INTEL_GEN4ASM"; then
15003b705cfSriastradh			AC_MSG_ERROR([intel-gen4asm enabled, but not found. Tried '$INTEL_GEN4ASM'.])
15103b705cfSriastradh		fi
15203b705cfSriastradh		AC_MSG_RESULT([$INTEL_GEN4ASM])
15303b705cfSriastradh		AC_SUBST([INTEL_GEN4ASM])
15403b705cfSriastradh	fi
15503b705cfSriastradhfi
15642542f5fSchristosAM_CONDITIONAL(HAVE_GEN4ASM, test "x$gen4asm" = "xyes")
1578c7da7f0Smrg
15803b705cfSriastradh# Check for atomic intrinsics
15903b705cfSriastradhAC_CACHE_CHECK([for native atomic primitives], intel_cv_atomic_primitives,
16003b705cfSriastradh[
16103b705cfSriastradh    intel_cv_atomic_primitives="none"
16203b705cfSriastradh
16303b705cfSriastradh    AC_LINK_IFELSE([AC_LANG_PROGRAM([[
16403b705cfSriastradhint atomic_add(int i) { return __sync_fetch_and_add (&i, 1); }
16503b705cfSriastradhint atomic_cmpxchg(int i, int j, int k) { return __sync_val_compare_and_swap (&i, j, k); }
16603b705cfSriastradh				    ]],[[]])],
16703b705cfSriastradh		   [intel_cv_atomic_primitives="Intel"],[])
16803b705cfSriastradh
16903b705cfSriastradh    if test "x$intel_cv_atomic_primitives" = "xnone"; then
17003b705cfSriastradh	    AC_CHECK_HEADER([atomic_ops.h], intel_cv_atomic_primitives="libatomic-ops")
17103b705cfSriastradh    fi
17203b705cfSriastradh
17303b705cfSriastradh    # atomic functions defined in <atomic.h> & libc on Solaris
17403b705cfSriastradh    if test "x$intel_cv_atomic_primitives" = "xnone"; then
17503b705cfSriastradh	    AC_CHECK_FUNC([atomic_cas_uint],
17603b705cfSriastradh			  intel_cv_atomic_primitives="Solaris")
17703b705cfSriastradh    fi
17803b705cfSriastradh
17903b705cfSriastradh])
18042542f5fSchristosif test "x$intel_cv_atomic_primitives" = "xIntel"; then
18103b705cfSriastradh    AC_DEFINE(HAVE_ATOMIC_PRIMITIVES, 1,
18203b705cfSriastradh	      [Enable if your compiler supports the Intel __sync_* atomic primitives])
18303b705cfSriastradhfi
18403b705cfSriastradhif test "x$intel_cv_atomic_primitives" = "xlibatomic-ops"; then
18503b705cfSriastradh    AC_DEFINE(HAVE_LIB_ATOMIC_OPS, 1, [Enable if you have libatomic-ops-dev installed])
18603b705cfSriastradhfi
18703b705cfSriastradh
18803b705cfSriastradhif test "x$intel_cv_atomic_primitives" = "xnone"; then
18903b705cfSriastradh		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.])
19003b705cfSriastradhfi
19103b705cfSriastradh
19203b705cfSriastradhAC_ARG_ENABLE(udev,
19303b705cfSriastradh              AS_HELP_STRING([--disable-udev],
19403b705cfSriastradh                             [Disable udev-based monitor hotplug detection [default=auto]]),
19503b705cfSriastradh              [UDEV="$enableval"],
19603b705cfSriastradh              [UDEV=auto])
19703b705cfSriastradh
198fe8aea9eSmrgudev_msg=" disabled"
19942542f5fSchristosif test "x$UDEV" != "xno"; then
20042542f5fSchristos	PKG_CHECK_MODULES(UDEV, [libudev], [udev="yes"], [udev="no"])
201fe8aea9eSmrg	AC_CHECK_HEADERS([sys/stat.h], [], [udev="no"])
20242542f5fSchristos	if test "x$UDEV" = "xyes" -a "x$udev" != "xyes"; then
20303b705cfSriastradh		AC_MSG_ERROR([udev support requested but not found (libudev)])
20403b705cfSriastradh	fi
20542542f5fSchristos	if test "x$udev" = "xyes"; then
20603b705cfSriastradh		AC_DEFINE(HAVE_UDEV,1,[Enable udev-based monitor hotplug detection])
207fe8aea9eSmrg		udev_msg=" yes"
208fe8aea9eSmrg	else
209fe8aea9eSmrg		udev_msg=" no"
21003b705cfSriastradh	fi
21103b705cfSriastradhfi
21203b705cfSriastradh
213fe8aea9eSmrgPKG_CHECK_MODULES(X11, [x11 x11-xcb xcb-dri2 xcomposite xdamage xrender xrandr xext xfixes cairo cairo-xlib-xrender pixman-1 libpng], [x11="yes"], [x11="no"])
21442542f5fSchristosAM_CONDITIONAL(HAVE_X11, test "x$x11" = "xyes")
215fe8aea9eSmrgecho X11_CLFAGS="$X11_CLFAGS" X11_LIBS="$X11_LIBS"
21642542f5fSchristos
21742542f5fSchristoscpuid="yes"
21842542f5fSchristosAC_TRY_LINK([
21942542f5fSchristos	#include <cpuid.h>
22042542f5fSchristos	#include <stddef.h>
22142542f5fSchristos	],
22242542f5fSchristos	[
22342542f5fSchristos	int eax, ebx, ecx, edx;
22442542f5fSchristos	if (__get_cpuid_max(0, NULL) < 4)
22542542f5fSchristos		return 0;
22642542f5fSchristos	__cpuid_count(4, 0, eax, ebx, ecx, edx);
22742542f5fSchristos	],
22842542f5fSchristos	[cpuid="yes"],
22942542f5fSchristos	[cpuid="no"]
23042542f5fSchristos)
23142542f5fSchristosif test "x$cpuid" = "xyes"; then
23242542f5fSchristos	AC_DEFINE(HAVE_CPUID_H,1,[Found a useable cpuid.h])
23342542f5fSchristosfi
23442542f5fSchristos
23542542f5fSchristosshm=yes
23642542f5fSchristosAC_CHECK_HEADERS([sys/ipc.h sys/ipc.h], [], [shm="no"])
23742542f5fSchristosAC_CHECK_HEADERS([X11/extensions/XShm.h], [], [shm="no"], [
23842542f5fSchristos#include <X11/Xlibint.h>
23942542f5fSchristos#include <X11/Xproto.h>
24042542f5fSchristos])
24142542f5fSchristosAC_CHECK_HEADERS([X11/extensions/shmproto.h X11/extensions/shmstr.h], [], [], [
24242542f5fSchristos#include <X11/Xlibint.h>
24342542f5fSchristos#include <X11/Xproto.h>
24442542f5fSchristos])
24542542f5fSchristosif test "x$ac_cv_header_X11_extensions_shmproto_h" != "xyes" -a "x$ac_cv_header_X11_extensions_shmstr_h" != "xyes"; then
24642542f5fSchristos	shm="no"
24742542f5fSchristosfi
24842542f5fSchristos
24942542f5fSchristosif test "x$shm" = "xyes"; then
25042542f5fSchristos	AC_DEFINE([HAVE_MIT_SHM], 1, [Define to 1 if MIT-SHM is available])
25142542f5fSchristosfi
25242542f5fSchristos
253fe8aea9eSmrgPKG_CHECK_MODULES(X11_DRI3, [xcb-dri3 xcb-sync xcb-xfixes xcb-present x11-xcb xshmfence x11 xcomposite xdamage xrender xrandr xxf86vm xext libdrm], [x11_dri3="yes"], [x11_dri3="no"])
25442542f5fSchristosAM_CONDITIONAL(X11_DRI3, test "x$x11_dri3" = "xyes" -a "x$shm" = "xyes")
25542542f5fSchristosAM_CONDITIONAL(X11_SHM, test "x$shm" = "xyes")
25642542f5fSchristos
257fe8aea9eSmrgPKG_CHECK_MODULES(X11_VM, [xxf86vm], [x11_vm="yes"], [x11_vm="no"])
258fe8aea9eSmrgAM_CONDITIONAL(X11_VM, test "x$x11_vm" = "xyes")
259fe8aea9eSmrg
26042542f5fSchristosAC_ARG_ENABLE(tools,
26142542f5fSchristos              AS_HELP_STRING([--disable-tools],
26242542f5fSchristos			     [Enable building and installing the miscellaneous tools [default=auto]]),
26342542f5fSchristos              [tools="$enableval"], [tools="auto"])
26442542f5fSchristosif test "x$shm" != "xyes"; then
26542542f5fSchristos	if test "x$tools" = "xyes"; then
26642542f5fSchristos		AC_MSG_ERROR([Incomplete requirements for extra tools, X11 MIT-SHM extension required])
26742542f5fSchristos	fi
26842542f5fSchristos	tools="no"
26942542f5fSchristosfi
27042542f5fSchristosif test "x$tools" != "xno"; then
271fe8aea9eSmrg	ivo_requires="xrandr xdamage xfixes xcursor xtst xrender xscrnsaver xext x11 pixman-1"
27242542f5fSchristos	extra_cflags=""
27342542f5fSchristos
27442542f5fSchristos	ignore="xinerama"
27542542f5fSchristos	PKG_CHECK_MODULES(IVO_EXTRA, [$ignore],
27642542f5fSchristos			  [AC_CHECK_HEADERS([X11/extensions/Xinerama.h], [ivo_requires="$ignore $ivo_requires"], [],
27742542f5fSchristos					    [#include <X11/Xlibint.h>
27842542f5fSchristos					     #include <X11/Xproto.h>
27942542f5fSchristos					    ])], [ignore=""])
28042542f5fSchristos
28142542f5fSchristos	ignore="xcb-dri3 xcb-sync x11-xcb xshmfence x11"
28242542f5fSchristos	PKG_CHECK_MODULES(IVO_EXTRA, [$ignore], [ivo_requires="$ivo_requires $ignore"; extra_cflags="-DDRI3"], [ignore=""])
28342542f5fSchristos
28442542f5fSchristos	PKG_CHECK_MODULES(IVO, [$ivo_requires], [ivo="yes"], [ivo="no"])
28542542f5fSchristos	AC_CHECK_HEADER([sys/timerfd.h], [], [ivo="no"])
28642542f5fSchristos	if test "x$ivo" = "xno"; then
28742542f5fSchristos		if test "x$tools" = "xyes"; then
28842542f5fSchristos			AC_MSG_ERROR([Incomplete requirements for intel-virtual-output, requires $ivo_requires])
28942542f5fSchristos		fi
29042542f5fSchristos		tools="no"
29142542f5fSchristos	fi
2928c7da7f0Smrg
293fe8aea9eSmrg	PKG_CHECK_MODULES(TOOL_CURSOR, [xfixes x11 libpng], [cursor="yes"], [ivo="no"])
294fe8aea9eSmrg
29542542f5fSchristos	IVO_CFLAGS="$IVO_CFLAGS $extra_cflags"
29642542f5fSchristosfi
29742542f5fSchristosif test "x$tools" != "xno"; then
29842542f5fSchristos      tools_msg="$tools_msg intel-virtual-output"
29942542f5fSchristosfi
30042542f5fSchristosAC_MSG_CHECKING([whether to build additional tools])
30142542f5fSchristosAC_MSG_RESULT([$tools])
30242542f5fSchristosAM_CONDITIONAL(BUILD_TOOLS, test "x$tools" != "xno")
303fe8aea9eSmrgAM_CONDITIONAL(BUILD_TOOL_CURSOR, test "x$cursor" = "xyes")
3048c7da7f0Smrg
30503b705cfSriastradh# Define a configure option for an alternate module directory
3068c7da7f0SmrgAC_ARG_WITH(xorg-module-dir,
30703b705cfSriastradh            AS_HELP_STRING([--with-xorg-module-dir=DIR],
3088c7da7f0Smrg                           [Default xorg module directory [[default=$libdir/xorg/modules]]]),
3098c7da7f0Smrg            [moduledir="$withval"],
3108c7da7f0Smrg            [moduledir="$libdir/xorg/modules"])
3118c7da7f0Smrg
31242542f5fSchristosAC_ARG_ENABLE(dri,
31342542f5fSchristos	      AS_HELP_STRING([--disable-dri],
31442542f5fSchristos			     [Disable DRI support [[default=auto]]]),
31542542f5fSchristos	      [DRI=$enableval],
31642542f5fSchristos	      [DRI=auto])
31742542f5fSchristosAC_ARG_ENABLE(dri1,
31842542f5fSchristos	      AS_HELP_STRING([--disable-dri1],
319fe8aea9eSmrg			     [Disable DRI1 support [[default=auto]]]),
32042542f5fSchristos	      [DRI1=$enableval],
321fe8aea9eSmrg	      [DRI1=auto])
32242542f5fSchristosAC_ARG_ENABLE(dri2,
32342542f5fSchristos	      AS_HELP_STRING([--disable-dri2],
32442542f5fSchristos			     [Disable DRI2 support [[default=yes]]]),
32542542f5fSchristos	      [DRI2=$enableval],
32642542f5fSchristos	      [DRI2=yes])
32742542f5fSchristosAC_ARG_ENABLE(dri3,
328fe8aea9eSmrg	      AS_HELP_STRING([--disable-dri3],
329fe8aea9eSmrg			     [Disable DRI3 support [[default=yes]]]),
33042542f5fSchristos	      [DRI3=$enableval],
331fe8aea9eSmrg	      [DRI3=yes])
332fe8aea9eSmrgAC_ARG_WITH(default-dri,
333fe8aea9eSmrg	    AS_HELP_STRING([--with-default-dri],
334fe8aea9eSmrg			   [Select the default maximum DRI level [default 2]]),
335fe8aea9eSmrg	      [DRI_DEFAULT=$withval],
336fe8aea9eSmrg	      [DRI_DEFAULT=2])
337fe8aea9eSmrgif test "x$DRI_DEFAULT" = "x0"; then
338fe8aea9eSmrg	AC_DEFINE(DEFAULT_DRI_LEVEL, 0,[Default DRI level])
339fe8aea9eSmrgelse
340fe8aea9eSmrg	AC_DEFINE(DEFAULT_DRI_LEVEL, ~0, [Default DRI level])
341fe8aea9eSmrgfi
3428c7da7f0Smrg
34303b705cfSriastradhAC_ARG_ENABLE(xvmc, AS_HELP_STRING([--disable-xvmc],
34403b705cfSriastradh                                  [Disable XvMC support [[default=yes]]]),
3458c7da7f0Smrg              [XVMC="$enableval"],
34642542f5fSchristos              [XVMC="yes"])
34742542f5fSchristos
34842542f5fSchristosAC_ARG_ENABLE(kms,
34942542f5fSchristos	      AS_HELP_STRING([--enable-kms],
35042542f5fSchristos			     [Assume KMS support [[default=yes]]]),
35142542f5fSchristos              [KMS="$enableval"],
35242542f5fSchristos              [KMS="yes"])
35342542f5fSchristosAC_ARG_ENABLE(ums,
35442542f5fSchristos	      AS_HELP_STRING([--enable-ums],
35542542f5fSchristos			     [Assume UMS support [[default=auto]]]),
35642542f5fSchristos              [UMS="$enableval"],
35742542f5fSchristos              [UMS="auto"])
35842542f5fSchristos
35942542f5fSchristosAC_ARG_ENABLE(kms-only,
36042542f5fSchristos	      AS_HELP_STRING([--enable-kms-only],
36142542f5fSchristos			     [Only assume KMS support (no UMS) [[default=no]]]),
36242542f5fSchristos              [ONLY_KMS="$enableval"],
36342542f5fSchristos              [ONLY_KMS="no"])
36442542f5fSchristos
36542542f5fSchristosAC_ARG_ENABLE(ums-only,
36642542f5fSchristos	      AS_HELP_STRING([--enable-ums-only],
36742542f5fSchristos			     [Only assume UMS support (no KMS) [[default=no]]]),
36842542f5fSchristos              [ONLY_UMS="$enableval"],
36942542f5fSchristos              [ONLY_UMS="no"])
37003b705cfSriastradh
37103b705cfSriastradhrequired_xorg_server_version=1.6
37203b705cfSriastradhrequired_pixman_version=0.16
37303b705cfSriastradh
374fe8aea9eSmrgPKG_CHECK_EXISTS([pixman-1 >= 0.24.0],
375fe8aea9eSmrg		 AC_DEFINE([HAS_PIXMAN_TRIANGLES], 1, [Enable pixman triangle rasterisation])
376fe8aea9eSmrg		 [])
377fe8aea9eSmrgPKG_CHECK_EXISTS([pixman-1 >= 0.27.1],
378fe8aea9eSmrg		 [AC_DEFINE([HAS_PIXMAN_GLYPHS], 1, [Enable pixman glyph cache])],
379fe8aea9eSmrg		 [])
38042542f5fSchristos# Store the list of server defined optional extensions in REQUIRED_MODULES
38142542f5fSchristosXORG_DRIVER_CHECK_EXT(RANDR, randrproto)
38242542f5fSchristosXORG_DRIVER_CHECK_EXT(RENDER, renderproto)
38342542f5fSchristosXORG_DRIVER_CHECK_EXT(DPMSExtension, xextproto)
38442542f5fSchristos
38542542f5fSchristos# Obtain compiler/linker options for the driver dependencies
38642542f5fSchristosPKG_CHECK_MODULES(DRM, [libdrm >= 2.4.20]) # libdrm_intel is checked separately
38742542f5fSchristosPKG_CHECK_MODULES(PCIACCESS, [pciaccess >= 0.10])
38842542f5fSchristos
38903b705cfSriastradhAC_ARG_ENABLE(sna,
39003b705cfSriastradh	      AS_HELP_STRING([--enable-sna],
39142542f5fSchristos			     [Enable SandyBridge\'s New Acceleration (SNA) [default=auto]]),
39203b705cfSriastradh	      [SNA="$enableval"],
39303b705cfSriastradh	      [SNA=auto])
3942e76d66dSmrg
395fe8aea9eSmrgAC_CHECK_HEADERS([dev/wscons/wsconsio.h])
396fe8aea9eSmrgAC_FUNC_ALLOCA
397fe8aea9eSmrgAC_HEADER_MAJOR
398fe8aea9eSmrg
39903b705cfSriastradhif test "x$SNA" != "xno"; then
40003b705cfSriastradh	AC_DEFINE(USE_SNA, 1, [Enable SNA support])
40103b705cfSriastradh	AC_CHECK_HEADERS([sys/sysinfo.h], AC_CHECK_MEMBERS([struct sysinfo.totalram], [], [], [[#include <sys/sysinfo.h>]]))
40203b705cfSriastradhfi
40303b705cfSriastradh
40442542f5fSchristosuxa_requires_libdrm=2.4.52
405fe8aea9eSmrguxa_requires_pixman=0.24.0
406fe8aea9eSmrg
40703b705cfSriastradhAC_ARG_ENABLE(uxa,
40803b705cfSriastradh	      AS_HELP_STRING([--enable-uxa],
40942542f5fSchristos			     [Enable Unified Acceleration Architecture (UXA) [default=auto]]),
41003b705cfSriastradh	      [UXA="$enableval"],
41103b705cfSriastradh	      [UXA=auto])
41203b705cfSriastradhif test "x$UXA" = "xauto"; then
413fe8aea9eSmrg	PKG_CHECK_EXISTS([libdrm_intel >= $uxa_requires_libdrm pixman-1 >= $uxa_requires_pixman], [], [UXA=no])
41403b705cfSriastradhfi
41503b705cfSriastradhif test "x$UXA" != "xno"; then
41603b705cfSriastradh	AC_DEFINE(USE_UXA, 1, [Enable UXA support])
41742542f5fSchristos	PKG_CHECK_MODULES(DRMINTEL, [libdrm_intel >= $uxa_requires_libdrm])
41803b705cfSriastradh	required_pixman_version=0.24
41903b705cfSriastradh	UXA=yes
42003b705cfSriastradhfi
42103b705cfSriastradh
422fe8aea9eSmrgPKG_CHECK_MODULES(XORG, [xorg-server >= $required_xorg_server_version xproto fontsproto damageproto pixman-1 >= $required_pixman_version $REQUIRED_MODULES])
42342542f5fSchristosABI_VERSION=`$PKG_CONFIG --variable=abi_videodrv xorg-server`
424fe8aea9eSmrgXSERVER_VERSION=`$PKG_CONFIG --modversion xorg-server`
425fe8aea9eSmrgPIXMAN_VERSION=`$PKG_CONFIG --modversion pixman-1`
42642542f5fSchristos
42742542f5fSchristosif test "x$ONLY_UMS" = "xyes"; then
42842542f5fSchristos	UMS="yes"
42942542f5fSchristos	KMS="no"
43042542f5fSchristosfi
43142542f5fSchristos
43242542f5fSchristosif test "x$ONLY_KMS" = "xyes"; then
43342542f5fSchristos	UMS="no"
43442542f5fSchristos	KMS="yes"
43542542f5fSchristosfi
43642542f5fSchristos
43742542f5fSchristossave_CPPFLAGS=$CPPFLAGS
43842542f5fSchristosCPPFLAGS=$XORG_CFLAGS
43942542f5fSchristosAC_CHECK_HEADERS([vgaHW.h], legacy="yes", legacy="no")
44042542f5fSchristosCPPFLAGS=$save_CPPFLAGS
44142542f5fSchristosif test "x$UMS" = "xauto"; then
44242542f5fSchristos	UMS="$legacy"
44342542f5fSchristosfi
44442542f5fSchristosif test "x$UMS" = "xyes" -a "x$legacy" = "xno"; then
44542542f5fSchristos	AC_MSG_ERROR([vgaHW support required for UMS (i810) driver])
44642542f5fSchristosfi
44742542f5fSchristos
44842542f5fSchristosif test "x$UMS" = "xyes"; then
44942542f5fSchristos	AC_ARG_ENABLE(xaa,
45042542f5fSchristos		      AS_HELP_STRING([--enable-xaa],
45142542f5fSchristos				     [Enable legacy X Acceleration Architecture (XAA) for i810 chipsets [default=auto]]),
45242542f5fSchristos		      [XAA="$enableval"],
45342542f5fSchristos		      [XAA="auto"])
45442542f5fSchristos	if test "x$XAA" != "xno"; then
45542542f5fSchristos		save_CPPFLAGS=$CPPFLAGS
45642542f5fSchristos		CPPFLAGS=$XORG_CFLAGS
45742542f5fSchristos		AC_CHECK_HEADERS([xaa.h], XAA="yes", XAA="no")
45842542f5fSchristos		CPPFLAGS=$save_CPPFLAGS
45942542f5fSchristos	fi
46042542f5fSchristos	AC_MSG_CHECKING([whether to include XAA support])
46142542f5fSchristos	AC_MSG_RESULT([$XAA])
46242542f5fSchristos
46342542f5fSchristos	AC_ARG_ENABLE(dga,
46442542f5fSchristos		      AS_HELP_STRING([--enable-dga],
46542542f5fSchristos				     [Enable legacy Direct Graphics Access (DGA) for i810 chipsets [default=auto]]),
46642542f5fSchristos		      [DGA="$enableval"],
46742542f5fSchristos		      [DGA="auto"])
46842542f5fSchristos	if test "x$DGA" != "xno"; then
46942542f5fSchristos		save_CFLAGS=$CFLAGS
47042542f5fSchristos		CFLAGS=$XORG_CFLAGS
47142542f5fSchristos		AC_CHECK_HEADERS([dgaproc.h], DGA="yes", DGA="no", [#include <dixstruct.h>])
47242542f5fSchristos		CFLAGS=$save_CFLAGS
47342542f5fSchristos	fi
47442542f5fSchristos	AC_MSG_CHECKING([whether to include DGA support])
47542542f5fSchristos	AC_MSG_RESULT([$DGA])
47642542f5fSchristosfi
47742542f5fSchristosAM_CONDITIONAL(DGA, test "x$DGA" = "xyes")
47842542f5fSchristosAM_CONDITIONAL(XAA, test "x$XAA" = "xyes")
47942542f5fSchristos
48042542f5fSchristosAM_CONDITIONAL(KMS, test "x$KMS" = "xyes")
48142542f5fSchristosif test "x$KMS" = "xyes"; then
48242542f5fSchristos	AC_DEFINE(KMS,1,[Assume KMS support])
48342542f5fSchristosfi
48442542f5fSchristosAM_CONDITIONAL(UMS, test "x$UMS" = "xyes")
48542542f5fSchristosif test "x$UMS" = "xyes"; then
48642542f5fSchristos	AC_DEFINE(UMS,1,[Assume UMS support])
48742542f5fSchristosfi
48842542f5fSchristos
48942542f5fSchristoshave_dri1=no
49042542f5fSchristosXORG_DRIVER_CHECK_EXT(XF86DRI, xf86driproto)
49142542f5fSchristosif test "x$_EXT_CHECK" != "xno" -a "x$DRI" != "xno" -a "x$DRI1" != "xno" -a "x$UMS" = "xyes"; then
49242542f5fSchristos	PKG_CHECK_MODULES(DRI1, [xf86driproto], [have_dri1=$DRI], [have_dri1=no])
49342542f5fSchristos        save_CFLAGS="$CFLAGS"
49442542f5fSchristos        save_CPPFLAGS="$CPPFLAGS"
49542542f5fSchristos        CFLAGS="$CFLAGS $XORG_CFLAGS $DRI1_CFLAGS $DRM_CFLAGS"
49642542f5fSchristos        CPPFLAGS="$CPPFLAGS $XORG_CFLAGS $DRI1_CFLAGS $DRM_CFLAGS"
49742542f5fSchristos        AC_CHECK_HEADERS([dri.h sarea.h dristruct.h], [], [have_dri1=no],
49842542f5fSchristos                [/* for dri.h */
49942542f5fSchristos                 #include <xf86str.h>
50042542f5fSchristos                 /* for dristruct.h */
50142542f5fSchristos                 #include <xorg-server.h>
50242542f5fSchristos                 #ifdef HAVE_DRI_H
50342542f5fSchristos                 # include <dri.h>
50442542f5fSchristos                 #endif
50542542f5fSchristos                 #ifdef HAVE_SAREA_H
50642542f5fSchristos                 # include <sarea.h>
50742542f5fSchristos                 #endif
50842542f5fSchristos                ])
50942542f5fSchristos        CFLAGS="$save_CFLAGS"
51042542f5fSchristos        CPPFLAGS="$save_CPPFLAGS"
51142542f5fSchristosfi
51242542f5fSchristos
51342542f5fSchristosAC_MSG_CHECKING([whether to include DRI1 support])
51442542f5fSchristosAC_MSG_RESULT([$have_dri1])
51542542f5fSchristos
51642542f5fSchristosAM_CONDITIONAL(DRI1, test "x$have_dri1" != "xno")
51742542f5fSchristosif test "x$have_dri1" != "xno"; then
51842542f5fSchristos        AC_DEFINE(HAVE_DRI1,1,[Enable DRI1 driver support])
519fe8aea9eSmrg	str="DRI1"
520fe8aea9eSmrg	if test "x$DRI_DEFAULT" = "x1"; then
521fe8aea9eSmrg		AC_DEFINE(DEFAULT_DRI_LEVEL,1,[Default DRI level])
522fe8aea9eSmrg		str="*$str"
523fe8aea9eSmrg	fi
524fe8aea9eSmrg	dri_msg="$dri_msg $str"
52542542f5fSchristoselse
52642542f5fSchristos        DRI1_CFLAGS=""
52742542f5fSchristos        DRI1_LIBS=""
52842542f5fSchristos
52942542f5fSchristos        if test "x$DRI" = "xyes" -a "x$UMS" = "xyes" -a "x$DRI1" != "xno"; then
53042542f5fSchristos                AC_MSG_ERROR([DRI1 requested but prerequisites not found])
53142542f5fSchristos        fi
53242542f5fSchristosfi
53342542f5fSchristos
53442542f5fSchristoshave_dri2=no
53542542f5fSchristoshave_dri3=no
53642542f5fSchristosif test "x$DRI" != "xno"; then
53742542f5fSchristos	if test "x$DRI2" != "xno"; then
53842542f5fSchristos		PKG_CHECK_MODULES(DRI2, [dri2proto >= 2.6], [have_dri2=$DRI], [have_dri2=no])
53942542f5fSchristos	fi
54042542f5fSchristos	if test "x$have_dri2" != "xno"; then
54142542f5fSchristos		save_CFLAGS=$CFLAGS
54242542f5fSchristos		CFLAGS="$XORG_CFLAGS $DRM_CFLAGS $DRI1_CFLAGS $DRI2_CFLAGS"
54342542f5fSchristos		AC_CHECK_HEADERS([dri2.h], [], [have_dri2=no], [
54442542f5fSchristos#include <dixstruct.h>
54542542f5fSchristos#include <drm.h>
54642542f5fSchristos])
54742542f5fSchristos		CFLAGS=$save_CFLAGS
54842542f5fSchristos	fi
54942542f5fSchristos	if test "x$have_dri2" != "xno"; then
55042542f5fSchristos		dridriverdir=`$PKG_CONFIG --variable=dridriverdir dri`
55142542f5fSchristos		if test "x$dridriverdir" = "x"; then
55242542f5fSchristos			dridriverdir="$libdir/dri"
55342542f5fSchristos		fi
55442542f5fSchristos		AC_DEFINE_DIR(DRI_DRIVER_PATH, dridriverdir, [Default have_dri2 driver path])
55542542f5fSchristos	fi
55642542f5fSchristos
55742542f5fSchristos	if test "x$DRI3" != "xno"; then
55842542f5fSchristos		XORG_DRIVER_CHECK_EXT(DRI3, dri3proto)
55942542f5fSchristos		if test "x$_EXT_CHECK" != "xno"; then
56042542f5fSchristos			PKG_CHECK_MODULES(DRI3, [dri3proto], [have_dri3=$DRI], [])
56142542f5fSchristos		fi
56242542f5fSchristos	fi
56342542f5fSchristos	if test "x$have_dri3" != "xno"; then
56442542f5fSchristos		save_CFLAGS=$CFLAGS
56542542f5fSchristos		CFLAGS="$XORG_CFLAGS $DRI3_CFLAGS"
56642542f5fSchristos		AC_CHECK_DECL(DRI3, [], [have_dri3=no], [#include <xorg-server.h>])
56742542f5fSchristos		AC_CHECK_HEADERS([misyncstr.h misyncshm.h], [], [have_dri3=no], [
56842542f5fSchristos#include <xorg-server.h>
56942542f5fSchristos#include <xf86str.h>
57042542f5fSchristos#include <misync.h>
57142542f5fSchristos])
57242542f5fSchristos		CFLAGS=$save_CFLAGS
57342542f5fSchristos	fi
57442542f5fSchristosfi
57542542f5fSchristos
57642542f5fSchristosAC_MSG_CHECKING([whether to include DRI2 support])
57742542f5fSchristosAM_CONDITIONAL(DRI2, test "x$have_dri2" != "xno")
57842542f5fSchristosAC_MSG_RESULT([$have_dri2])
57942542f5fSchristosif test "x$have_dri2" != "xno"; then
58042542f5fSchristos        AC_DEFINE(HAVE_DRI2,1,[Enable DRI2 driver support])
581fe8aea9eSmrg	str="DRI2"
582fe8aea9eSmrg	if test "x$DRI_DEFAULT" = "x2"; then
583fe8aea9eSmrg		AC_DEFINE(DEFAULT_DRI_LEVEL,2,[Default DRI level])
584fe8aea9eSmrg		str="*$str"
585fe8aea9eSmrg	fi
586fe8aea9eSmrg	dri_msg="$dri_msg $str"
58742542f5fSchristoselse
58842542f5fSchristos	if test "x$DRI" = "xyes" -a "x$DRI2" != "xno" -a "x$KMS" = "xyes"; then
58942542f5fSchristos		AC_MSG_ERROR([DRI2 requested but prerequisites not found])
59042542f5fSchristos	fi
59142542f5fSchristos
59242542f5fSchristos	# UXA doesn't build without DRI2 headers, too late to fix
59342542f5fSchristos	UXA=no
59442542f5fSchristosfi
59542542f5fSchristos
59642542f5fSchristosAC_MSG_CHECKING([whether to include DRI3 support])
59742542f5fSchristosAM_CONDITIONAL(DRI3, test "x$have_dri3" != "xno")
59842542f5fSchristosAC_MSG_RESULT([$have_dri3])
59942542f5fSchristosif test "x$have_dri3" != "xno"; then
60042542f5fSchristos        AC_DEFINE(HAVE_DRI3,1,[Enable DRI3 driver support])
601fe8aea9eSmrg	str="DRI3"
602fe8aea9eSmrg	if test "x$DRI_DEFAULT" = "x3"; then
603fe8aea9eSmrg		AC_DEFINE(DEFAULT_DRI_LEVEL,3,[Default DRI level])
604fe8aea9eSmrg		str="*$str"
605fe8aea9eSmrg	fi
606fe8aea9eSmrg	dri_msg="$dri_msg $str"
60742542f5fSchristoselse
60842542f5fSchristos	if test "x$DRI" = "xyes" -a "x$DRI3" != "xno" -a "x$KMS" = "xyes"; then
60942542f5fSchristos		AC_MSG_ERROR([DRI3 requested but prerequisites not found])
61042542f5fSchristos	fi
61142542f5fSchristosfi
61242542f5fSchristos
613fe8aea9eSmrgAC_MSG_CHECKING([default DRI support])
614fe8aea9eSmrgAC_MSG_RESULT([$DEFAULT_DRI_DEFAULT])
615fe8aea9eSmrg
61642542f5fSchristosAC_CHECK_HEADERS([X11/extensions/dpmsconst.h])
61742542f5fSchristos
61842542f5fSchristosPRESENT="no"
61942542f5fSchristosXORG_DRIVER_CHECK_EXT(PRESENT, presentproto)
62042542f5fSchristosif test "x$_EXT_CHECK" != "xno"; then
62142542f5fSchristos	PKG_CHECK_MODULES(PRESENT, [presentproto], [PRESENT="yes"], [])
62242542f5fSchristosfi
62342542f5fSchristosif test "x$PRESENT" != "xno"; then
62442542f5fSchristos	save_CFLAGS=$CFLAGS
62542542f5fSchristos	CFLAGS="$XORG_CFLAGS $PRESENT_CFLAGS"
62642542f5fSchristos	AC_CHECK_HEADERS([present.h], [], [PRESENT="no"], [
62742542f5fSchristos#include <xorg-server.h>
62842542f5fSchristos#include <xf86str.h>
62942542f5fSchristos])
63042542f5fSchristos	CFLAGS=$save_CFLAGS
63142542f5fSchristosfi
63242542f5fSchristosAC_MSG_CHECKING([whether to include PRESENT support])
63342542f5fSchristosAM_CONDITIONAL(PRESENT, test "x$PRESENT" != "xno")
63442542f5fSchristosAC_MSG_RESULT([$PRESENT])
63542542f5fSchristosif test "x$PRESENT" != "xno"; then
63642542f5fSchristos        AC_DEFINE(HAVE_PRESENT,1,[Enable PRESENT driver support])
63742542f5fSchristos	dri_msg="$dri_msg Present"
63842542f5fSchristosfi
63942542f5fSchristos
64042542f5fSchristosAC_MSG_CHECKING([whether to include UXA support])
64142542f5fSchristosAC_MSG_RESULT([$UXA])
64242542f5fSchristosAM_CONDITIONAL(UXA, test "x$UXA" != "xno")
64342542f5fSchristos
64442542f5fSchristosAC_MSG_CHECKING([whether to include SNA support])
64542542f5fSchristosAM_CONDITIONAL(SNA, test "x$SNA" != "xno")
64642542f5fSchristosAC_MSG_RESULT([$SNA])
64742542f5fSchristos
64842542f5fSchristosif test "$XVMC" = "yes"; then
64942542f5fSchristos	PKG_CHECK_MODULES(XVMCLIB, [xvmc dri2proto x11 x11-xcb xcb-dri2 xcb-aux libdrm_intel], [], [XVMC="no"])
65042542f5fSchristosfi
65142542f5fSchristosAC_MSG_CHECKING([whether to include XvMC support])
65242542f5fSchristosAC_MSG_RESULT([$XVMC])
65342542f5fSchristosAM_CONDITIONAL(XVMC, test "x$XVMC" = "xyes")
65442542f5fSchristosif test "x$XVMC" = "xyes"; then
65542542f5fSchristos	AC_DEFINE(ENABLE_XVMC,1,[Enable XvMC support])
65642542f5fSchristos	xvmc_msg=" yes"
65742542f5fSchristoselse
65842542f5fSchristos	xvmc_msg=" no"
65942542f5fSchristosfi
6608c7da7f0Smrg
66103b705cfSriastradh
66203b705cfSriastradhAC_ARG_WITH(default-accel,
66303b705cfSriastradh	    AS_HELP_STRING([--with-default-accel],
66413496ba1Ssnj			   [Select the default acceleration method out of none, sna, or uxa  [default is sna if enabled, otherwise uxa]]),
66503b705cfSriastradh			   [accel="$withval"],
66642542f5fSchristos			   [accel="auto"])
66742542f5fSchristosif test "x$accel" = "xyes"; then
66803b705cfSriastradh	AC_MSG_WARN([No default acceleration specified, choosing automatic selection])
66903b705cfSriastradh	accel="auto"
6708c7da7f0Smrgfi
67103b705cfSriastradh
67203b705cfSriastradhAC_MSG_CHECKING([which acceleration method to use by default])
67342542f5fSchristosif test "x$accel" = "xauto"; then
67442542f5fSchristos	if test "x$SNA" != "xno"; then
67542542f5fSchristos		accel="sna"
6768c7da7f0Smrg	else
67742542f5fSchristos		if test "x$UXA" != "xno"; then
67842542f5fSchristos			accel="uxa"
67903b705cfSriastradh		fi
68003b705cfSriastradh	fi
68142542f5fSchristos	if test "x$accel" = "xauto" -a "x$KMS" = "xyes"; then
68203b705cfSriastradh		AC_MSG_ERROR([No default acceleration option])
6838c7da7f0Smrg	fi
68403b705cfSriastradhfi
68503b705cfSriastradh
68642542f5fSchristoshave_accel="none"
68742542f5fSchristosif test "x$accel" = "xsna"; then
68803b705cfSriastradh	if test "x$SNA" != "xno"; then
68903b705cfSriastradh		AC_DEFINE(DEFAULT_ACCEL_METHOD, SNA, [Default acceleration method])
69042542f5fSchristos		have_accel="yes"
6918c7da7f0Smrg	else
69203b705cfSriastradh		AC_MSG_ERROR([SNA requested as default, but is not enabled])
6938c7da7f0Smrg	fi
6948c7da7f0Smrgfi
6958c7da7f0Smrg
69642542f5fSchristosif test "x$accel" = "xuxa"; then
69703b705cfSriastradh	if test "x$UXA" != "xno"; then
69803b705cfSriastradh		AC_DEFINE(DEFAULT_ACCEL_METHOD, UXA, [Default acceleration method])
69942542f5fSchristos		have_accel="yes"
7008c7da7f0Smrg	else
70103b705cfSriastradh		AC_MSG_ERROR([UXA requested as default, but is not enabled])
7028c7da7f0Smrg	fi
70303b705cfSriastradhfi
70442542f5fSchristos
70542542f5fSchristosif test "x$have_accel" = "xnone"; then
70642542f5fSchristos	if test "x$KMS" = "xyes"; then
70742542f5fSchristos		if test "x$SNA" != "xno" -o "x$UXA" != "xno"; then
70842542f5fSchristos			AC_DEFINE(DEFAULT_ACCEL_METHOD, NOACCEL, [Default acceleration method])
70942542f5fSchristos		else
71042542f5fSchristos			AC_MSG_ERROR([Invalid default acceleration option])
71142542f5fSchristos		fi
71242542f5fSchristos	fi
71342542f5fSchristos	accel="none"
71442542f5fSchristosfi
71542542f5fSchristosAC_MSG_RESULT($accel)
71642542f5fSchristos
71703b705cfSriastradhxp_msg=""
71803b705cfSriastradh
71942542f5fSchristosAC_ARG_ENABLE(tear-free,
72042542f5fSchristos	      AS_HELP_STRING([--enable-tear-free],
72142542f5fSchristos			     [Enable use of TearFree by default [default=no]]),
72242542f5fSchristos	      [TEARFREE="$enableval"],
72342542f5fSchristos	      [TEARFREE="no"])
72442542f5fSchristosif test "x$TEARFREE" = "xyes"; then
72542542f5fSchristos	AC_DEFINE(TEARFREE,1,[Enable "TearFree" by default])
72642542f5fSchristos	xp_msg="$xp_msg TearFree"
72742542f5fSchristosfi
72842542f5fSchristos
72903b705cfSriastradhAC_ARG_ENABLE(create2,
73003b705cfSriastradh	      AS_HELP_STRING([--enable-create2],
73103b705cfSriastradh			     [Enable use of create2 ioctl (experimental) [default=no]]),
73203b705cfSriastradh	      [CREATE2="$enableval"],
73342542f5fSchristos	      [CREATE2="no"])
73442542f5fSchristosAM_CONDITIONAL(USE_CREATE2, test "x$CREATE2" = "xyes")
73542542f5fSchristosif test "x$CREATE2" = "xyes"; then
73603b705cfSriastradh	AC_DEFINE(USE_CREATE2,1,[Assume "create2" support])
73703b705cfSriastradh	xp_msg="$xp_msg create2"
73803b705cfSriastradhfi
7398c7da7f0Smrg
74003b705cfSriastradhAC_ARG_ENABLE(async-swap,
74103b705cfSriastradh	      AS_HELP_STRING([--enable-async-swap],
74203b705cfSriastradh			     [Enable use of asynchronous swaps (experimental) [default=no]]),
74303b705cfSriastradh	      [ASYNC_SWAP="$enableval"],
74442542f5fSchristos	      [ASYNC_SWAP="no"])
74542542f5fSchristosAM_CONDITIONAL(USE_ASYNC_SWAP, test "x$ASYNC_SWAP" = "xyes")
74642542f5fSchristosif test "x$ASYNC_SWAP" = "xyes"; then
74703b705cfSriastradh	AC_DEFINE(USE_ASYNC_SWAP,1,[Assume asynchronous swap support])
74803b705cfSriastradh	xp_msg="$xp_msg async-swap"
74903b705cfSriastradhfi
7508c7da7f0Smrg
75103b705cfSriastradhAC_ARG_ENABLE(debug,
75203b705cfSriastradh	      AS_HELP_STRING([--enable-debug],
75303b705cfSriastradh			     [Enables internal debugging [default=no]]),
75403b705cfSriastradh              [DEBUG="$enableval"],
75542542f5fSchristos              [DEBUG="no"])
75603b705cfSriastradhAC_ARG_ENABLE(valgrind,
75703b705cfSriastradh	      AS_HELP_STRING([--enable-valgrind],
75803b705cfSriastradh			     [Enables valgrindified ioctls for debugging [default=no]]),
75903b705cfSriastradh              [VG="$enableval"],
76042542f5fSchristos              [VG="no"])
76103b705cfSriastradh
76203b705cfSriastradhLIBS=""
76303b705cfSriastradhAC_SEARCH_LIBS(clock_gettime, rt, [CLOCK_GETTIME_LIBS=$LIBS])
76403b705cfSriastradhAC_SUBST(CLOCK_GETTIME_LIBS)
76503b705cfSriastradh
76603b705cfSriastradhsdkdir=`$PKG_CONFIG --variable=sdkdir xorg-server`
76703b705cfSriastradh
76842542f5fSchristosAM_CONDITIONAL(DEBUG, test "x$DEBUG" != "xno")
76942542f5fSchristosAM_CONDITIONAL(FULL_DEBUG, test "x$DEBUG" = "xfull")
77042542f5fSchristosif test "x$DEBUG" = "xno"; then
77103b705cfSriastradh	AC_DEFINE(NDEBUG,1,[Disable internal debugging])
77203b705cfSriastradhelse
77342542f5fSchristos	if test "x$VG" != "xyes"; then
77403b705cfSriastradh		VG=auto
77503b705cfSriastradh	fi
77603b705cfSriastradhfi
77703b705cfSriastradhdebug_msg=""
77842542f5fSchristoshave_valgrind="no"
77942542f5fSchristosif test "x$VG" != "xno"; then
78042542f5fSchristos	PKG_CHECK_MODULES(VALGRIND, [valgrind], have_valgrind="yes", have_valgrind="no")
78103b705cfSriastradh	AC_MSG_CHECKING([whether to include valgrind support])
78242542f5fSchristos	if test "x$have_valgrind" = "xyes"; then
78303b705cfSriastradh		AC_DEFINE([HAVE_VALGRIND], 1, [Use valgrind intrinsics to suppress false warnings])
78403b705cfSriastradh	else
78542542f5fSchristos		if test "x$VG" = "xyes"; then
78603b705cfSriastradh			AC_MSG_ERROR([valgrind support requested, but valgrind-dev headers not found])
78703b705cfSriastradh		fi
78803b705cfSriastradh	fi
78903b705cfSriastradh	AC_MSG_RESULT([$have_valgrind ($VG)])
79003b705cfSriastradhfi
79142542f5fSchristosAM_CONDITIONAL(VALGRIND, test "x$have_valgrind" = "xyes")
79242542f5fSchristosif test "x$have_valgrind" = "xyes"; then
79303b705cfSriastradh	debug_msg="$debug_msg valgrind"
79403b705cfSriastradhfi
79542542f5fSchristosif test "x$DEBUG" = "xsync"; then
79603b705cfSriastradh	AC_DEFINE(DEBUG_SYNC,1,[Enable synchronous rendering for debugging])
79703b705cfSriastradh	debug_msg="$debug_msg sync"
79803b705cfSriastradhfi
79942542f5fSchristosif test "x$DEBUG" = "xmemory"; then
80003b705cfSriastradh	AC_DEFINE(DEBUG_MEMORY,1,[Enable memory debugging])
80103b705cfSriastradh	debug_msg="$debug_msg memory"
80203b705cfSriastradhfi
80342542f5fSchristosif test "x$DEBUG" = "xpixmap"; then
80403b705cfSriastradh	AC_DEFINE(DEBUG_PIXMAP,1,[Enable pixmap debugging])
80503b705cfSriastradh	debug_msg="$debug_msg pixmaps"
80603b705cfSriastradhfi
80742542f5fSchristosif test "x$DEBUG" = "xfull"; then
80803b705cfSriastradh	AC_DEFINE(DEBUG_MEMORY,1,[Enable memory debugging])
80903b705cfSriastradh	AC_DEFINE(DEBUG_PIXMAP,1,[Enable pixmap debugging])
81003b705cfSriastradh	AC_DEFINE(HAS_DEBUG_FULL,1,[Enable all debugging])
81103b705cfSriastradh        CFLAGS="$CFLAGS -O0 -ggdb3"
81203b705cfSriastradh	debug_msg=" full"
81303b705cfSriastradhfi
81442542f5fSchristosif test "x$debug_msg" = "x"; then
81503b705cfSriastradh	debug_msg=" none"
81603b705cfSriastradhfi
8178c7da7f0Smrg
81842542f5fSchristosAC_CONFIG_LIBOBJ_DIR(libobj)
81942542f5fSchristosAC_REPLACE_FUNCS(getline)
82042542f5fSchristos
82142542f5fSchristosDRIVER_NAME="intel"
8228c7da7f0SmrgAC_SUBST([DRIVER_NAME])
82303b705cfSriastradhAC_SUBST([moduledir])
82442542f5fSchristosAC_DEFINE_DIR([PREFIX_PATH], prefix, [installation prefix])
82542542f5fSchristosAC_DEFINE_DIR([LIBEXEC_PATH], libexecdir, [libexec directory])
8268c7da7f0Smrg
82703b705cfSriastradhAC_CONFIG_FILES([
82803b705cfSriastradh                Makefile
82903b705cfSriastradh                man/Makefile
83042542f5fSchristos		libobj/Makefile
83103b705cfSriastradh                src/Makefile
83203b705cfSriastradh                src/legacy/Makefile
83303b705cfSriastradh                src/legacy/i810/Makefile
83403b705cfSriastradh                src/legacy/i810/xvmc/Makefile
83503b705cfSriastradh                src/render_program/Makefile
83603b705cfSriastradh                src/sna/Makefile
83703b705cfSriastradh                src/sna/brw/Makefile
83803b705cfSriastradh                src/sna/fb/Makefile
83903b705cfSriastradh                src/uxa/Makefile
84003b705cfSriastradh                xvmc/Makefile
84103b705cfSriastradh                xvmc/shader/Makefile
84203b705cfSriastradh                xvmc/shader/mc/Makefile
84303b705cfSriastradh                xvmc/shader/vld/Makefile
84403b705cfSriastradh		test/Makefile
845fe8aea9eSmrg		benchmarks/Makefile
84642542f5fSchristos		tools/Makefile
84742542f5fSchristos		tools/org.x.xf86-video-intel.backlight-helper.policy
8488c7da7f0Smrg])
84903b705cfSriastradhAC_OUTPUT
85003b705cfSriastradh
85142542f5fSchristosecho ""
85242542f5fSchristosecho ""
853fe8aea9eSmrgcat $srcdir/README
85442542f5fSchristos
85503b705cfSriastradhaccel_msg=""
85603b705cfSriastradhif test "x$SNA" != "xno"; then
85742542f5fSchristos	if test "$accel" = "none"; then
85842542f5fSchristos		accel_msg="$accel_msg *none"
85942542f5fSchristos	else
86042542f5fSchristos		accel_msg="$accel_msg none"
86142542f5fSchristos	fi
86203b705cfSriastradh	if test "$accel" = "sna"; then
86303b705cfSriastradh		accel_msg="$accel_msg *sna"
86403b705cfSriastradh	else
86503b705cfSriastradh		accel_msg="$accel_msg sna"
86603b705cfSriastradh	fi
86703b705cfSriastradhfi
86803b705cfSriastradhif test "x$UXA" != "xno"; then
86942542f5fSchristos	if test "x$SNA" = "xno"; then
87042542f5fSchristos		if test "$accel" = "none"; then
87142542f5fSchristos			accel_msg="$accel_msg *none"
87242542f5fSchristos		else
87342542f5fSchristos			accel_msg="$accel_msg none"
87442542f5fSchristos		fi
87542542f5fSchristos	fi
87603b705cfSriastradh	if test "$accel" = "uxa"; then
87703b705cfSriastradh		accel_msg="$accel_msg *uxa"
87803b705cfSriastradh	else
87903b705cfSriastradh		accel_msg="$accel_msg uxa"
88003b705cfSriastradh	fi
88103b705cfSriastradhfi
88203b705cfSriastradh
88342542f5fSchristosif test "x$dri_msg" = "x"; then
88403b705cfSriastradh	dri_msg=" none"
88503b705cfSriastradhfi
88603b705cfSriastradh
88742542f5fSchristosif test "x$tools_msg" = "x"; then
88842542f5fSchristos	tools_msg=" none"
88942542f5fSchristosfi
89042542f5fSchristos
89103b705cfSriastradhecho ""
89203b705cfSriastradhecho "AC_PACKAGE_STRING will be compiled with:"
893fe8aea9eSmrgecho "  Xorg Video ABI version: $ABI_VERSION (xorg-server-$XSERVER_VERSION)"
894fe8aea9eSmrgecho "  pixman version: pixman-1-$PIXMAN_VERSION"
89503b705cfSriastradhecho "  Acceleration backends:$accel_msg"
89603b705cfSriastradhecho "  Additional debugging support?$debug_msg"
89742542f5fSchristosecho "  Support for Kernel Mode Setting? $KMS"
89842542f5fSchristosecho "  Support for legacy User Mode Setting (for i810)? $UMS"
89903b705cfSriastradhecho "  Support for Direct Rendering Infrastructure:$dri_msg"
90003b705cfSriastradhecho "  Support for Xv motion compensation (XvMC and libXvMC):$xvmc_msg"
901fe8aea9eSmrgecho "  Support for display hotplug notifications (udev):$udev_msg"
90242542f5fSchristosecho "  Build additional tools and utilities?$tools_msg"
90303b705cfSriastradhif test -n "$xp_msg"; then
90403b705cfSriastradhecho "  Experimental support:$xp_msg"
90503b705cfSriastradhfi
90603b705cfSriastradhecho ""
907