configure.ac revision 42542f5f
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],
2642542f5fSchristos        [2.99.916],
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
19842542f5fSchristosif test "x$UDEV" != "xno"; then
19942542f5fSchristos	PKG_CHECK_MODULES(UDEV, [libudev], [udev="yes"], [udev="no"])
20042542f5fSchristos	if test "x$UDEV" = "xyes" -a "x$udev" != "xyes"; then
20103b705cfSriastradh		AC_MSG_ERROR([udev support requested but not found (libudev)])
20203b705cfSriastradh	fi
20342542f5fSchristos	if test "x$udev" = "xyes"; then
20403b705cfSriastradh		AC_DEFINE(HAVE_UDEV,1,[Enable udev-based monitor hotplug detection])
20503b705cfSriastradh	fi
20603b705cfSriastradhfi
20703b705cfSriastradh
20842542f5fSchristosPKG_CHECK_MODULES(X11, [x11 xrender xrandr xext xfixes cairo cairo-xlib-xrender pixman-1 libpng], [x11="yes"], [x11="no"])
20942542f5fSchristosAM_CONDITIONAL(HAVE_X11, test "x$x11" = "xyes")
21042542f5fSchristos
21142542f5fSchristoscpuid="yes"
21242542f5fSchristosAC_TRY_LINK([
21342542f5fSchristos	#include <cpuid.h>
21442542f5fSchristos	#include <stddef.h>
21542542f5fSchristos	],
21642542f5fSchristos	[
21742542f5fSchristos	int eax, ebx, ecx, edx;
21842542f5fSchristos	if (__get_cpuid_max(0, NULL) < 4)
21942542f5fSchristos		return 0;
22042542f5fSchristos	__cpuid_count(4, 0, eax, ebx, ecx, edx);
22142542f5fSchristos	],
22242542f5fSchristos	[cpuid="yes"],
22342542f5fSchristos	[cpuid="no"]
22442542f5fSchristos)
22542542f5fSchristosif test "x$cpuid" = "xyes"; then
22642542f5fSchristos	AC_DEFINE(HAVE_CPUID_H,1,[Found a useable cpuid.h])
22742542f5fSchristosfi
22842542f5fSchristos
22942542f5fSchristosshm=yes
23042542f5fSchristosAC_CHECK_HEADERS([sys/ipc.h sys/ipc.h], [], [shm="no"])
23142542f5fSchristosAC_CHECK_HEADERS([X11/extensions/XShm.h], [], [shm="no"], [
23242542f5fSchristos#include <X11/Xlibint.h>
23342542f5fSchristos#include <X11/Xproto.h>
23442542f5fSchristos])
23542542f5fSchristosAC_CHECK_HEADERS([X11/extensions/shmproto.h X11/extensions/shmstr.h], [], [], [
23642542f5fSchristos#include <X11/Xlibint.h>
23742542f5fSchristos#include <X11/Xproto.h>
23842542f5fSchristos])
23942542f5fSchristosif test "x$ac_cv_header_X11_extensions_shmproto_h" != "xyes" -a "x$ac_cv_header_X11_extensions_shmstr_h" != "xyes"; then
24042542f5fSchristos	shm="no"
24142542f5fSchristosfi
24242542f5fSchristos
24342542f5fSchristosif test "x$shm" = "xyes"; then
24442542f5fSchristos	AC_MSG_CHECKING(whether shmctl IPC_RMID allows subsequent attaches)
24542542f5fSchristos	AC_TRY_RUN([
24642542f5fSchristos		  #include <sys/types.h>
24742542f5fSchristos		  #include <sys/ipc.h>
24842542f5fSchristos		  #include <sys/shm.h>
24942542f5fSchristos		  int main()
25042542f5fSchristos		  {
25142542f5fSchristos		      char *shmaddr;
25242542f5fSchristos		      int id = shmget (IPC_PRIVATE, 4, IPC_CREAT | 0600);
25342542f5fSchristos		      if (id == -1) return 2;
25442542f5fSchristos		      shmaddr = shmat (id, 0, 0);
25542542f5fSchristos		      shmctl (id, IPC_RMID, 0);
25642542f5fSchristos		      if ((char*) shmat (id, 0, 0) == (char*) -1) {
25742542f5fSchristos			  shmdt (shmaddr);
25842542f5fSchristos			  return 1;
25942542f5fSchristos		      }
26042542f5fSchristos		      shmdt (shmaddr);
26142542f5fSchristos		      shmdt (shmaddr);
26242542f5fSchristos		      return 0;
26342542f5fSchristos		  }
26442542f5fSchristos		  ],
26542542f5fSchristos		  AC_DEFINE(IPC_RMID_DEFERRED_RELEASE, 1,
26642542f5fSchristos			    [Define to 1 if shared memory segments are released deferred.])
26742542f5fSchristos		  AC_MSG_RESULT(yes),
26842542f5fSchristos		  AC_MSG_RESULT(no),
26942542f5fSchristos		  AC_MSG_RESULT(assuming no))
27042542f5fSchristos	AC_DEFINE([HAVE_MIT_SHM], 1, [Define to 1 if MIT-SHM is available])
27142542f5fSchristosfi
27242542f5fSchristos
27342542f5fSchristosPKG_CHECK_MODULES(X11_DRI3, [xcb-dri3 xcb-sync xcb-present x11-xcb xshmfence x11 xrender xext libdrm], [x11_dri3="yes"], [x11_dri3="no"])
27442542f5fSchristosAM_CONDITIONAL(X11_DRI3, test "x$x11_dri3" = "xyes" -a "x$shm" = "xyes")
27542542f5fSchristosAM_CONDITIONAL(X11_SHM, test "x$shm" = "xyes")
27642542f5fSchristos
27742542f5fSchristosAC_ARG_ENABLE(tools,
27842542f5fSchristos              AS_HELP_STRING([--disable-tools],
27942542f5fSchristos			     [Enable building and installing the miscellaneous tools [default=auto]]),
28042542f5fSchristos              [tools="$enableval"], [tools="auto"])
28142542f5fSchristosif test "x$shm" != "xyes"; then
28242542f5fSchristos	if test "x$tools" = "xyes"; then
28342542f5fSchristos		AC_MSG_ERROR([Incomplete requirements for extra tools, X11 MIT-SHM extension required])
28442542f5fSchristos	fi
28542542f5fSchristos	tools="no"
28642542f5fSchristosfi
28742542f5fSchristosif test "x$tools" != "xno"; then
28842542f5fSchristos	ivo_requires="xrandr xdamage xfixes xcursor xtst xrender xext x11 pixman-1"
28942542f5fSchristos	extra_cflags=""
29042542f5fSchristos
29142542f5fSchristos	ignore="xinerama"
29242542f5fSchristos	PKG_CHECK_MODULES(IVO_EXTRA, [$ignore],
29342542f5fSchristos			  [AC_CHECK_HEADERS([X11/extensions/Xinerama.h], [ivo_requires="$ignore $ivo_requires"], [],
29442542f5fSchristos					    [#include <X11/Xlibint.h>
29542542f5fSchristos					     #include <X11/Xproto.h>
29642542f5fSchristos					    ])], [ignore=""])
29742542f5fSchristos
29842542f5fSchristos	ignore="xcb-dri3 xcb-sync x11-xcb xshmfence x11"
29942542f5fSchristos	PKG_CHECK_MODULES(IVO_EXTRA, [$ignore], [ivo_requires="$ivo_requires $ignore"; extra_cflags="-DDRI3"], [ignore=""])
30042542f5fSchristos
30142542f5fSchristos	PKG_CHECK_MODULES(IVO, [$ivo_requires], [ivo="yes"], [ivo="no"])
30242542f5fSchristos	AC_CHECK_HEADER([sys/timerfd.h], [], [ivo="no"])
30342542f5fSchristos	if test "x$ivo" = "xno"; then
30442542f5fSchristos		if test "x$tools" = "xyes"; then
30542542f5fSchristos			AC_MSG_ERROR([Incomplete requirements for intel-virtual-output, requires $ivo_requires])
30642542f5fSchristos		fi
30742542f5fSchristos		tools="no"
30842542f5fSchristos	fi
3098c7da7f0Smrg
31042542f5fSchristos	IVO_CFLAGS="$IVO_CFLAGS $extra_cflags"
31142542f5fSchristosfi
31242542f5fSchristosif test "x$tools" != "xno"; then
31342542f5fSchristos      tools_msg="$tools_msg intel-virtual-output"
31442542f5fSchristosfi
31542542f5fSchristosAC_MSG_CHECKING([whether to build additional tools])
31642542f5fSchristosAC_MSG_RESULT([$tools])
31742542f5fSchristosAM_CONDITIONAL(BUILD_TOOLS, test "x$tools" != "xno")
3188c7da7f0Smrg
31903b705cfSriastradh# Define a configure option for an alternate module directory
3208c7da7f0SmrgAC_ARG_WITH(xorg-module-dir,
32103b705cfSriastradh            AS_HELP_STRING([--with-xorg-module-dir=DIR],
3228c7da7f0Smrg                           [Default xorg module directory [[default=$libdir/xorg/modules]]]),
3238c7da7f0Smrg            [moduledir="$withval"],
3248c7da7f0Smrg            [moduledir="$libdir/xorg/modules"])
3258c7da7f0Smrg
32642542f5fSchristosAC_ARG_ENABLE(dri,
32742542f5fSchristos	      AS_HELP_STRING([--disable-dri],
32842542f5fSchristos			     [Disable DRI support [[default=auto]]]),
32942542f5fSchristos	      [DRI=$enableval],
33042542f5fSchristos	      [DRI=auto])
33142542f5fSchristosAC_ARG_ENABLE(dri1,
33242542f5fSchristos	      AS_HELP_STRING([--disable-dri1],
33342542f5fSchristos			     [Disable DRI1 support [[default=yes]]]),
33442542f5fSchristos	      [DRI1=$enableval],
33542542f5fSchristos	      [DRI1=yes])
33642542f5fSchristosAC_ARG_ENABLE(dri2,
33742542f5fSchristos	      AS_HELP_STRING([--disable-dri2],
33842542f5fSchristos			     [Disable DRI2 support [[default=yes]]]),
33942542f5fSchristos	      [DRI2=$enableval],
34042542f5fSchristos	      [DRI2=yes])
34142542f5fSchristosAC_ARG_ENABLE(dri3,
34242542f5fSchristos	      AS_HELP_STRING([--disable-dri3],
34342542f5fSchristos			     [Disable DRI3 support [[default=yes]]]),
34442542f5fSchristos	      [DRI3=$enableval],
34542542f5fSchristos	      [DRI3=yes])
3468c7da7f0Smrg
34703b705cfSriastradhAC_ARG_ENABLE(xvmc, AS_HELP_STRING([--disable-xvmc],
34803b705cfSriastradh                                  [Disable XvMC support [[default=yes]]]),
3498c7da7f0Smrg              [XVMC="$enableval"],
35042542f5fSchristos              [XVMC="yes"])
35142542f5fSchristos
35242542f5fSchristosAC_ARG_ENABLE(kms,
35342542f5fSchristos	      AS_HELP_STRING([--enable-kms],
35442542f5fSchristos			     [Assume KMS support [[default=yes]]]),
35542542f5fSchristos              [KMS="$enableval"],
35642542f5fSchristos              [KMS="yes"])
35742542f5fSchristosAC_ARG_ENABLE(ums,
35842542f5fSchristos	      AS_HELP_STRING([--enable-ums],
35942542f5fSchristos			     [Assume UMS support [[default=auto]]]),
36042542f5fSchristos              [UMS="$enableval"],
36142542f5fSchristos              [UMS="auto"])
36242542f5fSchristos
36342542f5fSchristosAC_ARG_ENABLE(kms-only,
36442542f5fSchristos	      AS_HELP_STRING([--enable-kms-only],
36542542f5fSchristos			     [Only assume KMS support (no UMS) [[default=no]]]),
36642542f5fSchristos              [ONLY_KMS="$enableval"],
36742542f5fSchristos              [ONLY_KMS="no"])
36842542f5fSchristos
36942542f5fSchristosAC_ARG_ENABLE(ums-only,
37042542f5fSchristos	      AS_HELP_STRING([--enable-ums-only],
37142542f5fSchristos			     [Only assume UMS support (no KMS) [[default=no]]]),
37242542f5fSchristos              [ONLY_UMS="$enableval"],
37342542f5fSchristos              [ONLY_UMS="no"])
37403b705cfSriastradh
37503b705cfSriastradhrequired_xorg_server_version=1.6
37603b705cfSriastradhrequired_pixman_version=0.16
37703b705cfSriastradh
37803b705cfSriastradhif pkg-config --exists 'pixman-1 >= 0.27.1'; then
37903b705cfSriastradh	AC_DEFINE([HAS_PIXMAN_GLYPHS], 1, [Enable pixman glyph cache])
38003b705cfSriastradhfi
3818c7da7f0Smrg
38203b705cfSriastradhif pkg-config --exists 'pixman-1 >= 0.24.0'; then
38303b705cfSriastradh	AC_DEFINE([HAS_PIXMAN_TRIANGLES], 1, [Enable pixman triangle rasterisation])
38403b705cfSriastradhfi
3852e76d66dSmrg
38642542f5fSchristos# Store the list of server defined optional extensions in REQUIRED_MODULES
38742542f5fSchristosXORG_DRIVER_CHECK_EXT(RANDR, randrproto)
38842542f5fSchristosXORG_DRIVER_CHECK_EXT(RENDER, renderproto)
38942542f5fSchristosXORG_DRIVER_CHECK_EXT(DPMSExtension, xextproto)
39042542f5fSchristos
39142542f5fSchristos# Obtain compiler/linker options for the driver dependencies
39242542f5fSchristosPKG_CHECK_MODULES(DRM, [libdrm >= 2.4.20]) # libdrm_intel is checked separately
39342542f5fSchristosPKG_CHECK_MODULES(PCIACCESS, [pciaccess >= 0.10])
39442542f5fSchristos
39503b705cfSriastradhAC_ARG_ENABLE(sna,
39603b705cfSriastradh	      AS_HELP_STRING([--enable-sna],
39742542f5fSchristos			     [Enable SandyBridge\'s New Acceleration (SNA) [default=auto]]),
39803b705cfSriastradh	      [SNA="$enableval"],
39903b705cfSriastradh	      [SNA=auto])
4002e76d66dSmrg
40103b705cfSriastradhif test "x$SNA" != "xno"; then
40203b705cfSriastradh	AC_DEFINE(USE_SNA, 1, [Enable SNA support])
40303b705cfSriastradh	AC_CHECK_HEADERS([sys/sysinfo.h], AC_CHECK_MEMBERS([struct sysinfo.totalram], [], [], [[#include <sys/sysinfo.h>]]))
40403b705cfSriastradhfi
40503b705cfSriastradh
40642542f5fSchristosuxa_requires_libdrm=2.4.52
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
41342542f5fSchristos	if ! pkg-config --exists "libdrm_intel >= $uxa_requires_libdrm"; then
41403b705cfSriastradh		UXA=no
41503b705cfSriastradh	fi
41603b705cfSriastradh	if ! pkg-config --exists 'pixman-1 >= 0.24.0'; then
41703b705cfSriastradh		UXA=no
41803b705cfSriastradh	fi
41903b705cfSriastradhfi
42003b705cfSriastradhif test "x$UXA" != "xno"; then
42103b705cfSriastradh	AC_DEFINE(USE_UXA, 1, [Enable UXA support])
42242542f5fSchristos	PKG_CHECK_MODULES(DRMINTEL, [libdrm_intel >= $uxa_requires_libdrm])
42303b705cfSriastradh	required_pixman_version=0.24
42403b705cfSriastradh	UXA=yes
42503b705cfSriastradhfi
42603b705cfSriastradh
42703b705cfSriastradhAC_ARG_ENABLE(glamor,
42803b705cfSriastradh	      AS_HELP_STRING([--enable-glamor],
42903b705cfSriastradh			     [Enable glamor, a new GL-based acceleration [default=no]]),
43003b705cfSriastradh	      [GLAMOR="$enableval"],
43142542f5fSchristos	      [GLAMOR="no"])
43203b705cfSriastradhif test "x$GLAMOR" != "xno"; then
43342542f5fSchristos	if test "x$UXA" != "xyes"; then
43442542f5fSchristos		AC_MSG_ERROR([Glamor acceleration requested but UXA is not enabled])
43542542f5fSchristos	fi
43642542f5fSchristos	if pkg-config --exists "xorg-server >= 1.15.99.901"; then
43742542f5fSchristos		GLAMOR="yes (using Xorg glamor module)"
43842542f5fSchristos	else
43942542f5fSchristos		PKG_CHECK_MODULES(LIBGLAMOR, [glamor >= 0.6.0])
44042542f5fSchristos		PKG_CHECK_MODULES(LIBGLAMOR_EGL, [glamor-egl])
44142542f5fSchristos		GLAMOR="yes (using libglamor)"
44242542f5fSchristos	fi
44303b705cfSriastradh	AC_DEFINE(USE_GLAMOR, 1, [Enable glamor acceleration])
4442e76d66dSmrgfi
4452e76d66dSmrg
44603b705cfSriastradhPKG_CHECK_MODULES(XORG, [xorg-server >= $required_xorg_server_version xproto fontsproto pixman-1 >= $required_pixman_version $REQUIRED_MODULES])
44742542f5fSchristosABI_VERSION=`$PKG_CONFIG --variable=abi_videodrv xorg-server`
44842542f5fSchristos
44942542f5fSchristosif test "x$ONLY_UMS" = "xyes"; then
45042542f5fSchristos	UMS="yes"
45142542f5fSchristos	KMS="no"
45242542f5fSchristosfi
45342542f5fSchristos
45442542f5fSchristosif test "x$ONLY_KMS" = "xyes"; then
45542542f5fSchristos	UMS="no"
45642542f5fSchristos	KMS="yes"
45742542f5fSchristosfi
45842542f5fSchristos
45942542f5fSchristossave_CPPFLAGS=$CPPFLAGS
46042542f5fSchristosCPPFLAGS=$XORG_CFLAGS
46142542f5fSchristosAC_CHECK_HEADERS([vgaHW.h], legacy="yes", legacy="no")
46242542f5fSchristosCPPFLAGS=$save_CPPFLAGS
46342542f5fSchristosif test "x$UMS" = "xauto"; then
46442542f5fSchristos	UMS="$legacy"
46542542f5fSchristosfi
46642542f5fSchristosif test "x$UMS" = "xyes" -a "x$legacy" = "xno"; then
46742542f5fSchristos	AC_MSG_ERROR([vgaHW support required for UMS (i810) driver])
46842542f5fSchristosfi
46942542f5fSchristos
47042542f5fSchristosif test "x$UMS" = "xyes"; then
47142542f5fSchristos	AC_ARG_ENABLE(xaa,
47242542f5fSchristos		      AS_HELP_STRING([--enable-xaa],
47342542f5fSchristos				     [Enable legacy X Acceleration Architecture (XAA) for i810 chipsets [default=auto]]),
47442542f5fSchristos		      [XAA="$enableval"],
47542542f5fSchristos		      [XAA="auto"])
47642542f5fSchristos	if test "x$XAA" != "xno"; then
47742542f5fSchristos		save_CPPFLAGS=$CPPFLAGS
47842542f5fSchristos		CPPFLAGS=$XORG_CFLAGS
47942542f5fSchristos		AC_CHECK_HEADERS([xaa.h], XAA="yes", XAA="no")
48042542f5fSchristos		CPPFLAGS=$save_CPPFLAGS
48142542f5fSchristos	fi
48242542f5fSchristos	AC_MSG_CHECKING([whether to include XAA support])
48342542f5fSchristos	AC_MSG_RESULT([$XAA])
48442542f5fSchristos
48542542f5fSchristos	AC_ARG_ENABLE(dga,
48642542f5fSchristos		      AS_HELP_STRING([--enable-dga],
48742542f5fSchristos				     [Enable legacy Direct Graphics Access (DGA) for i810 chipsets [default=auto]]),
48842542f5fSchristos		      [DGA="$enableval"],
48942542f5fSchristos		      [DGA="auto"])
49042542f5fSchristos	if test "x$DGA" != "xno"; then
49142542f5fSchristos		save_CFLAGS=$CFLAGS
49242542f5fSchristos		CFLAGS=$XORG_CFLAGS
49342542f5fSchristos		AC_CHECK_HEADERS([dgaproc.h], DGA="yes", DGA="no", [#include <dixstruct.h>])
49442542f5fSchristos		CFLAGS=$save_CFLAGS
49542542f5fSchristos	fi
49642542f5fSchristos	AC_MSG_CHECKING([whether to include DGA support])
49742542f5fSchristos	AC_MSG_RESULT([$DGA])
49842542f5fSchristosfi
49942542f5fSchristosAM_CONDITIONAL(DGA, test "x$DGA" = "xyes")
50042542f5fSchristosAM_CONDITIONAL(XAA, test "x$XAA" = "xyes")
50142542f5fSchristos
50242542f5fSchristosAM_CONDITIONAL(KMS, test "x$KMS" = "xyes")
50342542f5fSchristosif test "x$KMS" = "xyes"; then
50442542f5fSchristos	AC_DEFINE(KMS,1,[Assume KMS support])
50542542f5fSchristosfi
50642542f5fSchristosAM_CONDITIONAL(UMS, test "x$UMS" = "xyes")
50742542f5fSchristosif test "x$UMS" = "xyes"; then
50842542f5fSchristos	AC_DEFINE(UMS,1,[Assume UMS support])
50942542f5fSchristosfi
51042542f5fSchristos
51142542f5fSchristoshave_dri1=no
51242542f5fSchristosXORG_DRIVER_CHECK_EXT(XF86DRI, xf86driproto)
51342542f5fSchristosif test "x$_EXT_CHECK" != "xno" -a "x$DRI" != "xno" -a "x$DRI1" != "xno" -a "x$UMS" = "xyes"; then
51442542f5fSchristos	PKG_CHECK_MODULES(DRI1, [xf86driproto], [have_dri1=$DRI], [have_dri1=no])
51542542f5fSchristos        save_CFLAGS="$CFLAGS"
51642542f5fSchristos        save_CPPFLAGS="$CPPFLAGS"
51742542f5fSchristos        CFLAGS="$CFLAGS $XORG_CFLAGS $DRI1_CFLAGS $DRM_CFLAGS"
51842542f5fSchristos        CPPFLAGS="$CPPFLAGS $XORG_CFLAGS $DRI1_CFLAGS $DRM_CFLAGS"
51942542f5fSchristos        AC_CHECK_HEADERS([dri.h sarea.h dristruct.h], [], [have_dri1=no],
52042542f5fSchristos                [/* for dri.h */
52142542f5fSchristos                 #include <xf86str.h>
52242542f5fSchristos                 /* for dristruct.h */
52342542f5fSchristos                 #include <xorg-server.h>
52442542f5fSchristos                 #ifdef HAVE_DRI_H
52542542f5fSchristos                 # include <dri.h>
52642542f5fSchristos                 #endif
52742542f5fSchristos                 #ifdef HAVE_SAREA_H
52842542f5fSchristos                 # include <sarea.h>
52942542f5fSchristos                 #endif
53042542f5fSchristos                ])
53142542f5fSchristos        CFLAGS="$save_CFLAGS"
53242542f5fSchristos        CPPFLAGS="$save_CPPFLAGS"
53342542f5fSchristosfi
53442542f5fSchristos
53542542f5fSchristosAC_MSG_CHECKING([whether to include DRI1 support])
53642542f5fSchristosAC_MSG_RESULT([$have_dri1])
53742542f5fSchristos
53842542f5fSchristosAM_CONDITIONAL(DRI1, test "x$have_dri1" != "xno")
53942542f5fSchristosif test "x$have_dri1" != "xno"; then
54042542f5fSchristos        AC_DEFINE(HAVE_DRI1,1,[Enable DRI1 driver support])
54142542f5fSchristos	dri_msg="$dri_msg DRI1"
54242542f5fSchristoselse
54342542f5fSchristos        DRI1_CFLAGS=""
54442542f5fSchristos        DRI1_LIBS=""
54542542f5fSchristos
54642542f5fSchristos        if test "x$DRI" = "xyes" -a "x$UMS" = "xyes" -a "x$DRI1" != "xno"; then
54742542f5fSchristos                AC_MSG_ERROR([DRI1 requested but prerequisites not found])
54842542f5fSchristos        fi
54942542f5fSchristosfi
55042542f5fSchristos
55142542f5fSchristoshave_dri2=no
55242542f5fSchristoshave_dri3=no
55342542f5fSchristosif test "x$DRI" != "xno"; then
55442542f5fSchristos	if test "x$DRI2" != "xno"; then
55542542f5fSchristos		PKG_CHECK_MODULES(DRI2, [dri2proto >= 2.6], [have_dri2=$DRI], [have_dri2=no])
55642542f5fSchristos	fi
55742542f5fSchristos	if test "x$have_dri2" != "xno"; then
55842542f5fSchristos		save_CFLAGS=$CFLAGS
55942542f5fSchristos		CFLAGS="$XORG_CFLAGS $DRM_CFLAGS $DRI1_CFLAGS $DRI2_CFLAGS"
56042542f5fSchristos		AC_CHECK_HEADERS([dri2.h], [], [have_dri2=no], [
56142542f5fSchristos#include <dixstruct.h>
56242542f5fSchristos#include <drm.h>
56342542f5fSchristos])
56442542f5fSchristos		CFLAGS=$save_CFLAGS
56542542f5fSchristos	fi
56642542f5fSchristos	if test "x$have_dri2" != "xno"; then
56742542f5fSchristos		dridriverdir=`$PKG_CONFIG --variable=dridriverdir dri`
56842542f5fSchristos		if test "x$dridriverdir" = "x"; then
56942542f5fSchristos			dridriverdir="$libdir/dri"
57042542f5fSchristos		fi
57142542f5fSchristos		AC_DEFINE_DIR(DRI_DRIVER_PATH, dridriverdir, [Default have_dri2 driver path])
57242542f5fSchristos	fi
57342542f5fSchristos
57442542f5fSchristos	if test "x$DRI3" != "xno"; then
57542542f5fSchristos		XORG_DRIVER_CHECK_EXT(DRI3, dri3proto)
57642542f5fSchristos		if test "x$_EXT_CHECK" != "xno"; then
57742542f5fSchristos			PKG_CHECK_MODULES(DRI3, [dri3proto], [have_dri3=$DRI], [])
57842542f5fSchristos		fi
57942542f5fSchristos	fi
58042542f5fSchristos	if test "x$have_dri3" != "xno"; then
58142542f5fSchristos		save_CFLAGS=$CFLAGS
58242542f5fSchristos		CFLAGS="$XORG_CFLAGS $DRI3_CFLAGS"
58342542f5fSchristos		AC_CHECK_DECL(DRI3, [], [have_dri3=no], [#include <xorg-server.h>])
58442542f5fSchristos		AC_CHECK_HEADERS([misyncstr.h misyncshm.h], [], [have_dri3=no], [
58542542f5fSchristos#include <xorg-server.h>
58642542f5fSchristos#include <xf86str.h>
58742542f5fSchristos#include <misync.h>
58842542f5fSchristos])
58942542f5fSchristos		CFLAGS=$save_CFLAGS
59042542f5fSchristos	fi
59142542f5fSchristosfi
59242542f5fSchristos
59342542f5fSchristosAC_MSG_CHECKING([whether to include DRI2 support])
59442542f5fSchristosAM_CONDITIONAL(DRI2, test "x$have_dri2" != "xno")
59542542f5fSchristosAC_MSG_RESULT([$have_dri2])
59642542f5fSchristosif test "x$have_dri2" != "xno"; then
59742542f5fSchristos        AC_DEFINE(HAVE_DRI2,1,[Enable DRI2 driver support])
59842542f5fSchristos	dri_msg="$dri_msg DRI2"
59942542f5fSchristoselse
60042542f5fSchristos	if test "x$DRI" = "xyes" -a "x$DRI2" != "xno" -a "x$KMS" = "xyes"; then
60142542f5fSchristos		AC_MSG_ERROR([DRI2 requested but prerequisites not found])
60242542f5fSchristos	fi
60342542f5fSchristos
60442542f5fSchristos	# UXA doesn't build without DRI2 headers, too late to fix
60542542f5fSchristos	UXA=no
60642542f5fSchristosfi
60742542f5fSchristos
60842542f5fSchristosAC_MSG_CHECKING([whether to include DRI3 support])
60942542f5fSchristosAM_CONDITIONAL(DRI3, test "x$have_dri3" != "xno")
61042542f5fSchristosAC_MSG_RESULT([$have_dri3])
61142542f5fSchristosif test "x$have_dri3" != "xno"; then
61242542f5fSchristos        AC_DEFINE(HAVE_DRI3,1,[Enable DRI3 driver support])
61342542f5fSchristos	dri_msg="$dri_msg DRI3"
61442542f5fSchristoselse
61542542f5fSchristos	if test "x$DRI" = "xyes" -a "x$DRI3" != "xno" -a "x$KMS" = "xyes"; then
61642542f5fSchristos		AC_MSG_ERROR([DRI3 requested but prerequisites not found])
61742542f5fSchristos	fi
61842542f5fSchristosfi
61942542f5fSchristos
62042542f5fSchristosAC_CHECK_HEADERS([X11/extensions/dpmsconst.h])
62142542f5fSchristos
62242542f5fSchristosPRESENT="no"
62342542f5fSchristosXORG_DRIVER_CHECK_EXT(PRESENT, presentproto)
62442542f5fSchristosif test "x$_EXT_CHECK" != "xno"; then
62542542f5fSchristos	PKG_CHECK_MODULES(PRESENT, [presentproto], [PRESENT="yes"], [])
62642542f5fSchristosfi
62742542f5fSchristosif test "x$PRESENT" != "xno"; then
62842542f5fSchristos	save_CFLAGS=$CFLAGS
62942542f5fSchristos	CFLAGS="$XORG_CFLAGS $PRESENT_CFLAGS"
63042542f5fSchristos	AC_CHECK_HEADERS([present.h], [], [PRESENT="no"], [
63142542f5fSchristos#include <xorg-server.h>
63242542f5fSchristos#include <xf86str.h>
63342542f5fSchristos])
63442542f5fSchristos	CFLAGS=$save_CFLAGS
63542542f5fSchristosfi
63642542f5fSchristosAC_MSG_CHECKING([whether to include PRESENT support])
63742542f5fSchristosAM_CONDITIONAL(PRESENT, test "x$PRESENT" != "xno")
63842542f5fSchristosAC_MSG_RESULT([$PRESENT])
63942542f5fSchristosif test "x$PRESENT" != "xno"; then
64042542f5fSchristos        AC_DEFINE(HAVE_PRESENT,1,[Enable PRESENT driver support])
64142542f5fSchristos	dri_msg="$dri_msg Present"
64242542f5fSchristosfi
64342542f5fSchristos
64442542f5fSchristosAC_MSG_CHECKING([whether to include UXA support])
64542542f5fSchristosAC_MSG_RESULT([$UXA])
64642542f5fSchristosAM_CONDITIONAL(UXA, test "x$UXA" != "xno")
64742542f5fSchristos
64842542f5fSchristosAC_MSG_CHECKING([whether to include GLAMOR support])
64942542f5fSchristosAC_MSG_RESULT([$GLAMOR])
65042542f5fSchristosAM_CONDITIONAL(GLAMOR, test "x$GLAMOR" != "xno")
65142542f5fSchristos
65242542f5fSchristosAC_MSG_CHECKING([whether to include SNA support])
65342542f5fSchristosAM_CONDITIONAL(SNA, test "x$SNA" != "xno")
65442542f5fSchristosAC_MSG_RESULT([$SNA])
65542542f5fSchristos
65642542f5fSchristosif test "$XVMC" = "yes"; then
65742542f5fSchristos	PKG_CHECK_MODULES(XVMCLIB, [xvmc dri2proto x11 x11-xcb xcb-dri2 xcb-aux libdrm_intel], [], [XVMC="no"])
65842542f5fSchristosfi
65942542f5fSchristosAC_MSG_CHECKING([whether to include XvMC support])
66042542f5fSchristosAC_MSG_RESULT([$XVMC])
66142542f5fSchristosAM_CONDITIONAL(XVMC, test "x$XVMC" = "xyes")
66242542f5fSchristosif test "x$XVMC" = "xyes"; then
66342542f5fSchristos	AC_DEFINE(ENABLE_XVMC,1,[Enable XvMC support])
66442542f5fSchristos	xvmc_msg=" yes"
66542542f5fSchristoselse
66642542f5fSchristos	xvmc_msg=" no"
66742542f5fSchristosfi
6688c7da7f0Smrg
66903b705cfSriastradh
67003b705cfSriastradhAC_ARG_WITH(default-accel,
67103b705cfSriastradh	    AS_HELP_STRING([--with-default-accel],
67242542f5fSchristos			   [Select the default acceleration method out of glamor, none, sna, or uxa  [default is sna if enabled, otherwise uxa]]),
67303b705cfSriastradh			   [accel="$withval"],
67442542f5fSchristos			   [accel="auto"])
67542542f5fSchristosif test "x$accel" = "xyes"; then
67603b705cfSriastradh	AC_MSG_WARN([No default acceleration specified, choosing automatic selection])
67703b705cfSriastradh	accel="auto"
6788c7da7f0Smrgfi
67903b705cfSriastradh
68003b705cfSriastradhAC_MSG_CHECKING([which acceleration method to use by default])
68142542f5fSchristosif test "x$accel" = "xauto"; then
68242542f5fSchristos	if test "x$SNA" != "xno"; then
68342542f5fSchristos		accel="sna"
6848c7da7f0Smrg	else
68542542f5fSchristos		if test "x$UXA" != "xno"; then
68642542f5fSchristos			accel="uxa"
68703b705cfSriastradh		fi
68803b705cfSriastradh	fi
68942542f5fSchristos	if test "x$accel" = "xauto" -a "x$KMS" = "xyes"; then
69003b705cfSriastradh		AC_MSG_ERROR([No default acceleration option])
6918c7da7f0Smrg	fi
69203b705cfSriastradhfi
69303b705cfSriastradh
69442542f5fSchristoshave_accel="none"
69542542f5fSchristosif test "x$accel" = "xsna"; then
69603b705cfSriastradh	if test "x$SNA" != "xno"; then
69703b705cfSriastradh		AC_DEFINE(DEFAULT_ACCEL_METHOD, SNA, [Default acceleration method])
69842542f5fSchristos		have_accel="yes"
6998c7da7f0Smrg	else
70003b705cfSriastradh		AC_MSG_ERROR([SNA requested as default, but is not enabled])
7018c7da7f0Smrg	fi
7028c7da7f0Smrgfi
7038c7da7f0Smrg
70442542f5fSchristosif test "x$accel" = "xuxa"; then
70503b705cfSriastradh	if test "x$UXA" != "xno"; then
70603b705cfSriastradh		AC_DEFINE(DEFAULT_ACCEL_METHOD, UXA, [Default acceleration method])
70742542f5fSchristos		have_accel="yes"
7088c7da7f0Smrg	else
70903b705cfSriastradh		AC_MSG_ERROR([UXA requested as default, but is not enabled])
7108c7da7f0Smrg	fi
71103b705cfSriastradhfi
71242542f5fSchristos
71342542f5fSchristosif test "x$accel" = "xglamor"; then
71442542f5fSchristos	if test "x$GLAMOR" != "xno"; then
71542542f5fSchristos		AC_DEFINE(DEFAULT_ACCEL_METHOD, GLAMOR, [Default acceleration method])
71642542f5fSchristos		have_accel="yes"
71742542f5fSchristos	else
71842542f5fSchristos		AC_MSG_ERROR([glamor acceleration requested as default, but is not enabled])
71942542f5fSchristos	fi
7208c7da7f0Smrgfi
7218c7da7f0Smrg
72242542f5fSchristosif test "x$have_accel" = "xnone"; then
72342542f5fSchristos	if test "x$KMS" = "xyes"; then
72442542f5fSchristos		if test "x$SNA" != "xno" -o "x$UXA" != "xno"; then
72542542f5fSchristos			AC_DEFINE(DEFAULT_ACCEL_METHOD, NOACCEL, [Default acceleration method])
72642542f5fSchristos		else
72742542f5fSchristos			AC_MSG_ERROR([Invalid default acceleration option])
72842542f5fSchristos		fi
72942542f5fSchristos	fi
73042542f5fSchristos	accel="none"
73142542f5fSchristosfi
73242542f5fSchristosAC_MSG_RESULT($accel)
73342542f5fSchristos
73403b705cfSriastradhxp_msg=""
73503b705cfSriastradh
73642542f5fSchristosAC_ARG_ENABLE(tear-free,
73742542f5fSchristos	      AS_HELP_STRING([--enable-tear-free],
73842542f5fSchristos			     [Enable use of TearFree by default [default=no]]),
73942542f5fSchristos	      [TEARFREE="$enableval"],
74042542f5fSchristos	      [TEARFREE="no"])
74142542f5fSchristosif test "x$TEARFREE" = "xyes"; then
74242542f5fSchristos	AC_DEFINE(TEARFREE,1,[Enable "TearFree" by default])
74342542f5fSchristos	xp_msg="$xp_msg TearFree"
74442542f5fSchristosfi
74542542f5fSchristos
74642542f5fSchristosAC_ARG_ENABLE(rendernode,
74742542f5fSchristos	      AS_HELP_STRING([--enable-rendernode],
74842542f5fSchristos			     [Enable use of render nodes (experimental) [default=no]]),
74942542f5fSchristos	      [RENDERNODE="$enableval"],
75042542f5fSchristos	      [RENDERNODE="no"])
75142542f5fSchristosAM_CONDITIONAL(USE_RENDERNODE, test "x$RENDERNODE" = "xyes")
75242542f5fSchristosif test "x$RENDERNODE" = "xyes"; then
75342542f5fSchristos	AC_DEFINE(USE_RENDERNODE,1,[Assume "rendernode" support])
75442542f5fSchristos	xp_msg="$xp_msg rendernode"
75542542f5fSchristosfi
75642542f5fSchristos
75703b705cfSriastradhAC_ARG_ENABLE(create2,
75803b705cfSriastradh	      AS_HELP_STRING([--enable-create2],
75903b705cfSriastradh			     [Enable use of create2 ioctl (experimental) [default=no]]),
76003b705cfSriastradh	      [CREATE2="$enableval"],
76142542f5fSchristos	      [CREATE2="no"])
76242542f5fSchristosAM_CONDITIONAL(USE_CREATE2, test "x$CREATE2" = "xyes")
76342542f5fSchristosif test "x$CREATE2" = "xyes"; then
76403b705cfSriastradh	AC_DEFINE(USE_CREATE2,1,[Assume "create2" support])
76503b705cfSriastradh	xp_msg="$xp_msg create2"
76603b705cfSriastradhfi
7678c7da7f0Smrg
76803b705cfSriastradhAC_ARG_ENABLE(async-swap,
76903b705cfSriastradh	      AS_HELP_STRING([--enable-async-swap],
77003b705cfSriastradh			     [Enable use of asynchronous swaps (experimental) [default=no]]),
77103b705cfSriastradh	      [ASYNC_SWAP="$enableval"],
77242542f5fSchristos	      [ASYNC_SWAP="no"])
77342542f5fSchristosAM_CONDITIONAL(USE_ASYNC_SWAP, test "x$ASYNC_SWAP" = "xyes")
77442542f5fSchristosif test "x$ASYNC_SWAP" = "xyes"; then
77503b705cfSriastradh	AC_DEFINE(USE_ASYNC_SWAP,1,[Assume asynchronous swap support])
77603b705cfSriastradh	xp_msg="$xp_msg async-swap"
77703b705cfSriastradhfi
7788c7da7f0Smrg
77903b705cfSriastradhAC_ARG_ENABLE(debug,
78003b705cfSriastradh	      AS_HELP_STRING([--enable-debug],
78103b705cfSriastradh			     [Enables internal debugging [default=no]]),
78203b705cfSriastradh              [DEBUG="$enableval"],
78342542f5fSchristos              [DEBUG="no"])
78403b705cfSriastradhAC_ARG_ENABLE(valgrind,
78503b705cfSriastradh	      AS_HELP_STRING([--enable-valgrind],
78603b705cfSriastradh			     [Enables valgrindified ioctls for debugging [default=no]]),
78703b705cfSriastradh              [VG="$enableval"],
78842542f5fSchristos              [VG="no"])
78903b705cfSriastradh
79003b705cfSriastradhLIBS=""
79103b705cfSriastradhAC_SEARCH_LIBS(clock_gettime, rt, [CLOCK_GETTIME_LIBS=$LIBS])
79203b705cfSriastradhAC_SUBST(CLOCK_GETTIME_LIBS)
79303b705cfSriastradh
79403b705cfSriastradhsdkdir=`$PKG_CONFIG --variable=sdkdir xorg-server`
79503b705cfSriastradh
79642542f5fSchristosAM_CONDITIONAL(DEBUG, test "x$DEBUG" != "xno")
79742542f5fSchristosAM_CONDITIONAL(FULL_DEBUG, test "x$DEBUG" = "xfull")
79842542f5fSchristosif test "x$DEBUG" = "xno"; then
79903b705cfSriastradh	AC_DEFINE(NDEBUG,1,[Disable internal debugging])
80003b705cfSriastradhelse
80142542f5fSchristos	if test "x$VG" != "xyes"; then
80203b705cfSriastradh		VG=auto
80303b705cfSriastradh	fi
80403b705cfSriastradhfi
80503b705cfSriastradhdebug_msg=""
80642542f5fSchristoshave_valgrind="no"
80742542f5fSchristosif test "x$VG" != "xno"; then
80842542f5fSchristos	PKG_CHECK_MODULES(VALGRIND, [valgrind], have_valgrind="yes", have_valgrind="no")
80903b705cfSriastradh	AC_MSG_CHECKING([whether to include valgrind support])
81042542f5fSchristos	if test "x$have_valgrind" = "xyes"; then
81103b705cfSriastradh		AC_DEFINE([HAVE_VALGRIND], 1, [Use valgrind intrinsics to suppress false warnings])
81203b705cfSriastradh	else
81342542f5fSchristos		if test "x$VG" = "xyes"; then
81403b705cfSriastradh			AC_MSG_ERROR([valgrind support requested, but valgrind-dev headers not found])
81503b705cfSriastradh		fi
81603b705cfSriastradh	fi
81703b705cfSriastradh	AC_MSG_RESULT([$have_valgrind ($VG)])
81803b705cfSriastradhfi
81942542f5fSchristosAM_CONDITIONAL(VALGRIND, test "x$have_valgrind" = "xyes")
82042542f5fSchristosif test "x$have_valgrind" = "xyes"; then
82103b705cfSriastradh	debug_msg="$debug_msg valgrind"
82203b705cfSriastradhfi
82342542f5fSchristosif test "x$DEBUG" = "xsync"; then
82403b705cfSriastradh	AC_DEFINE(DEBUG_SYNC,1,[Enable synchronous rendering for debugging])
82503b705cfSriastradh	debug_msg="$debug_msg sync"
82603b705cfSriastradhfi
82742542f5fSchristosif test "x$DEBUG" = "xmemory"; then
82803b705cfSriastradh	AC_DEFINE(DEBUG_MEMORY,1,[Enable memory debugging])
82903b705cfSriastradh	debug_msg="$debug_msg memory"
83003b705cfSriastradhfi
83142542f5fSchristosif test "x$DEBUG" = "xpixmap"; then
83203b705cfSriastradh	AC_DEFINE(DEBUG_PIXMAP,1,[Enable pixmap debugging])
83303b705cfSriastradh	debug_msg="$debug_msg pixmaps"
83403b705cfSriastradhfi
83542542f5fSchristosif test "x$DEBUG" = "xfull"; then
83603b705cfSriastradh	AC_DEFINE(DEBUG_MEMORY,1,[Enable memory debugging])
83703b705cfSriastradh	AC_DEFINE(DEBUG_PIXMAP,1,[Enable pixmap debugging])
83803b705cfSriastradh	AC_DEFINE(HAS_DEBUG_FULL,1,[Enable all debugging])
83903b705cfSriastradh        CFLAGS="$CFLAGS -O0 -ggdb3"
84003b705cfSriastradh	debug_msg=" full"
84103b705cfSriastradhfi
84242542f5fSchristosif test "x$debug_msg" = "x"; then
84303b705cfSriastradh	debug_msg=" none"
84403b705cfSriastradhfi
8458c7da7f0Smrg
84642542f5fSchristosAC_CONFIG_LIBOBJ_DIR(libobj)
84742542f5fSchristosAC_REPLACE_FUNCS(getline)
84842542f5fSchristos
84942542f5fSchristosDRIVER_NAME="intel"
8508c7da7f0SmrgAC_SUBST([DRIVER_NAME])
85103b705cfSriastradhAC_SUBST([moduledir])
85242542f5fSchristosAC_DEFINE_DIR([PREFIX_PATH], prefix, [installation prefix])
85342542f5fSchristosAC_DEFINE_DIR([LIBEXEC_PATH], libexecdir, [libexec directory])
8548c7da7f0Smrg
85503b705cfSriastradhAC_CONFIG_FILES([
85603b705cfSriastradh                Makefile
85703b705cfSriastradh                man/Makefile
85842542f5fSchristos		libobj/Makefile
85903b705cfSriastradh                src/Makefile
86003b705cfSriastradh                src/legacy/Makefile
86103b705cfSriastradh                src/legacy/i810/Makefile
86203b705cfSriastradh                src/legacy/i810/xvmc/Makefile
86303b705cfSriastradh                src/render_program/Makefile
86403b705cfSriastradh                src/sna/Makefile
86503b705cfSriastradh                src/sna/brw/Makefile
86603b705cfSriastradh                src/sna/fb/Makefile
86703b705cfSriastradh                src/uxa/Makefile
86803b705cfSriastradh                xvmc/Makefile
86903b705cfSriastradh                xvmc/shader/Makefile
87003b705cfSriastradh                xvmc/shader/mc/Makefile
87103b705cfSriastradh                xvmc/shader/vld/Makefile
87203b705cfSriastradh		test/Makefile
87342542f5fSchristos		tools/Makefile
87442542f5fSchristos		tools/org.x.xf86-video-intel.backlight-helper.policy
8758c7da7f0Smrg])
87603b705cfSriastradhAC_OUTPUT
87703b705cfSriastradh
87842542f5fSchristosecho ""
87942542f5fSchristosecho ""
88042542f5fSchristostest -e `pwd $0`/README && cat `pwd $0`/README
88142542f5fSchristos
88203b705cfSriastradhaccel_msg=""
88303b705cfSriastradhif test "x$SNA" != "xno"; then
88442542f5fSchristos	if test "$accel" = "none"; then
88542542f5fSchristos		accel_msg="$accel_msg *none"
88642542f5fSchristos	else
88742542f5fSchristos		accel_msg="$accel_msg none"
88842542f5fSchristos	fi
88903b705cfSriastradh	if test "$accel" = "sna"; then
89003b705cfSriastradh		accel_msg="$accel_msg *sna"
89103b705cfSriastradh	else
89203b705cfSriastradh		accel_msg="$accel_msg sna"
89303b705cfSriastradh	fi
89403b705cfSriastradhfi
89503b705cfSriastradhif test "x$UXA" != "xno"; then
89642542f5fSchristos	if test "x$SNA" = "xno"; then
89742542f5fSchristos		if test "$accel" = "none"; then
89842542f5fSchristos			accel_msg="$accel_msg *none"
89942542f5fSchristos		else
90042542f5fSchristos			accel_msg="$accel_msg none"
90142542f5fSchristos		fi
90242542f5fSchristos	fi
90303b705cfSriastradh	if test "$accel" = "uxa"; then
90403b705cfSriastradh		accel_msg="$accel_msg *uxa"
90503b705cfSriastradh	else
90603b705cfSriastradh		accel_msg="$accel_msg uxa"
90703b705cfSriastradh	fi
90803b705cfSriastradhfi
90903b705cfSriastradhif test "x$GLAMOR" != "xno"; then
91003b705cfSriastradh	if test "$accel" = "glamor"; then
91103b705cfSriastradh		accel_msg="$accel_msg *glamor"
91203b705cfSriastradh	else
91303b705cfSriastradh		accel_msg="$accel_msg glamor"
91403b705cfSriastradh	fi
91503b705cfSriastradhfi
91603b705cfSriastradh
91742542f5fSchristosif test "x$dri_msg" = "x"; then
91803b705cfSriastradh	dri_msg=" none"
91903b705cfSriastradhfi
92003b705cfSriastradh
92142542f5fSchristosif test "x$tools_msg" = "x"; then
92242542f5fSchristos	tools_msg=" none"
92342542f5fSchristosfi
92442542f5fSchristos
92503b705cfSriastradhecho ""
92603b705cfSriastradhecho "AC_PACKAGE_STRING will be compiled with:"
92742542f5fSchristosecho "  Xorg Video ABI version: $ABI_VERSION"
92803b705cfSriastradhecho "  Acceleration backends:$accel_msg"
92903b705cfSriastradhecho "  Additional debugging support?$debug_msg"
93042542f5fSchristosecho "  Support for Kernel Mode Setting? $KMS"
93142542f5fSchristosecho "  Support for legacy User Mode Setting (for i810)? $UMS"
93203b705cfSriastradhecho "  Support for Direct Rendering Infrastructure:$dri_msg"
93303b705cfSriastradhecho "  Support for Xv motion compensation (XvMC and libXvMC):$xvmc_msg"
93442542f5fSchristosecho "  Build additional tools and utilities?$tools_msg"
93503b705cfSriastradhif test -n "$xp_msg"; then
93603b705cfSriastradhecho "  Experimental support:$xp_msg"
93703b705cfSriastradhfi
93803b705cfSriastradhecho ""
939