take two
[profile/ivi/xorg-x11-drv-intel.git] / configure.ac
1 #  Copyright 2005 Adam Jackson.
2 #
3 #  Permission is hereby granted, free of charge, to any person obtaining a
4 #  copy of this software and associated documentation files (the "Software"),
5 #  to deal in the Software without restriction, including without limitation
6 #  on the rights to use, copy, modify, merge, publish, distribute, sub
7 #  license, and/or sell copies of the Software, and to permit persons to whom
8 #  the Software is furnished to do so, subject to the following conditions:
9 #
10 #  The above copyright notice and this permission notice (including the next
11 #  paragraph) shall be included in all copies or substantial portions of the
12 #  Software.
13 #
14 #  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 #  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 #  FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.  IN NO EVENT SHALL
17 #  ADAM JACKSON BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
18 #  IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19 #  CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20 #
21 # Process this file with autoconf to produce a configure script
22
23 # Initialize Autoconf
24 AC_PREREQ([2.60])
25 AC_INIT([xf86-video-intel],
26         [2.20.9],
27         [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
28         [xf86-video-intel])
29 AC_CONFIG_SRCDIR([Makefile.am])
30 AC_CONFIG_HEADERS([config.h])
31 AC_CONFIG_AUX_DIR(.)
32
33 # Initialize Automake
34 AM_INIT_AUTOMAKE([foreign dist-bzip2])
35 AM_MAINTAINER_MODE
36
37 # Require X.Org macros 1.8 or later for MAN_SUBSTS set by XORG_MANPAGE_SECTIONS
38 m4_ifndef([XORG_MACROS_VERSION],
39           [m4_fatal([must install xorg-macros 1.8 or later before running autoconf/autogen.
40   Hint: either install from source, git://anongit.freedesktop.org/xorg/util/macros or,
41   depending on you distribution, try package 'xutils-dev' or 'xorg-x11-util-macros'])])
42
43 XORG_MACROS_VERSION(1.8)
44 XORG_DEFAULT_OPTIONS
45
46 # Require X.Org server macros (i.e. XORG_DRIVER_CHECK_EXT) to check for required modules 
47 m4_ifndef([XORG_DRIVER_CHECK_EXT],
48           [m4_fatal([must install xorg-server macros before running autoconf/autogen.
49   Hint: either install from source, git://anongit.freedesktop.org/xorg/xserver or,
50   depending on your distribution, try package 'xserver-xorg-dev' or 'xorg-x11-server-devel'])])
51
52 # Initialize libtool
53 AC_DISABLE_STATIC
54 AC_PROG_LIBTOOL
55 AC_SYS_LARGEFILE
56
57 # Are we in a git checkout?
58 dot_git=no
59 if test -e .git; then
60         AC_DEFINE(HAVE_DOT_GIT, 1, [Are we in a git checkout?])
61         dot_git=yes
62 fi
63 AM_CONDITIONAL(HAVE_DOT_GIT, test x$dot_git = xyes)
64
65 # If so, we include the git description in our logs for sanity checking.
66 #
67 # However, for people not running their own drivers this is just noise.
68 # So we copy the xserver's builderstring idiom to allow for this to be
69 # overridden and perhaps replaced with something more useful.
70 AC_ARG_WITH(builderstring,
71             AS_HELP_STRING([--with-builderstring=BUILDERSTRING],
72                            [Additional builder string (default: use git describe)]),
73             [BUILDERSTRING="$withval"],
74             [BUILDERSTRING="x-magic-git-describe"])
75
76 if test "x$BUILDERSTRING" = xx-magic-git-describe -a x$dot_git = xyes; then
77         AC_DEFINE(USE_GIT_DESCRIBE, 1, [Use automagic builder description])
78 else
79   if test "x$BUILDERSTRING" != x -a "x$BUILDERSTRING" != xno -a "x$BUILDERSTRING" != xx-magic-git-describe; then
80           AC_DEFINE_UNQUOTED(BUILDER_DESCRIPTION, ["$BUILDERSTRING"], [Builder description])
81   fi
82 fi
83
84
85 PKG_CHECK_MODULES(GEN4ASM, [intel-gen4asm >= 1.2], [gen4asm=yes], [gen4asm=no])
86 AM_CONDITIONAL(HAVE_GEN4ASM, test x$gen4asm = xyes)
87
88 AC_ARG_ENABLE(udev,
89               AS_HELP_STRING([--disable-udev],
90                              [Disable udev-based monitor hotplug detection [default=auto]]),
91               [UDEV="$enableval"],
92               [UDEV=auto])
93
94 if test x$UDEV != "xno"; then
95         PKG_CHECK_MODULES(UDEV, [libudev], [udev=yes], [udev=no])
96         if test x$UDEV == xyes -a x$udev != xyes; then
97                 AC_MSG_ERROR([udev support requested but not found (libudev)])
98         fi
99         if test x$udev = xyes; then
100                 AC_DEFINE(HAVE_UDEV,1,[Enable udev-based monitor hotplug detection])
101         fi
102 fi
103
104 PKG_CHECK_MODULES(X11, [x11 xrender xext pixman-1], [x11=yes], [x11=no])
105 AM_CONDITIONAL(HAVE_X11, test x$x11 = xyes)
106
107 AH_TOP([#include "xorg-server.h"])
108
109 # Define a configure option for an alternate module directory
110 AC_ARG_WITH(xorg-module-dir,
111             AS_HELP_STRING([--with-xorg-module-dir=DIR],
112                            [Default xorg module directory [[default=$libdir/xorg/modules]]]),
113             [moduledir="$withval"],
114             [moduledir="$libdir/xorg/modules"])
115
116 AC_ARG_ENABLE(dri, AS_HELP_STRING([--disable-dri],
117                                   [Disable DRI support [[default=auto]]]))
118
119 AC_ARG_ENABLE(xvmc, AS_HELP_STRING([--disable-xvmc],
120                                   [Disable XvMC support [[default=yes]]]),
121               [XVMC="$enableval"],
122               [XVMC=yes])
123
124 AC_ARG_ENABLE(kms-only, AS_HELP_STRING([--enable-kms-only],
125                                   [Assume KMS support [[default=no]]]),
126               [KMS_ONLY="$enableval"],
127               [KMS_ONLY=no])
128 AC_ARG_ENABLE(ums-only, AS_HELP_STRING([--enable-ums-only],
129                                   [Assume only UMS (no KMS) support [[default=no]]]),
130               [UMS_ONLY="$enableval"],
131               [UMS_ONLY=no])
132
133 required_xorg_xserver_version=1.6
134 required_pixman_version=0.24
135
136 if pkg-config --exists 'pixman-1 >= 0.27.1'; then
137         AC_DEFINE([HAS_PIXMAN_GLYPHS], 1, [Enable pixman glyph cache])
138 fi
139
140 AC_ARG_ENABLE(sna,
141               AS_HELP_STRING([--enable-sna],
142                              [Enable SandyBridge's New Acceleration (SNA) [default=auto]]),
143               [SNA="$enableval"],
144               [SNA=auto])
145
146 AC_CHECK_HEADERS([sys/sysinfo.h], , SNA=no)
147 if test "x$SNA" = "xauto" && pkg-config --exists "xorg-server >= 1.10"; then
148         SNA=yes
149 fi
150 if test "x$SNA" != "xno"; then
151         required_xorg_xserver_version=1.10
152         AC_DEFINE(USE_SNA, 1, [Enable SNA support])
153 fi
154 AC_MSG_CHECKING([whether to include SNA support])
155 AM_CONDITIONAL(SNA, test x$SNA != xno)
156 AC_MSG_RESULT([$SNA])
157
158 AC_ARG_ENABLE(uxa,
159               AS_HELP_STRING([--enable-uxa],
160                              [Enable Unified Acceleration Architecture (UXA) [default=yes]]),
161               [UXA="$enableval"],
162               [UXA=yes])
163 AC_MSG_CHECKING([whether to include UXA support])
164 AM_CONDITIONAL(UXA, test x$UXA != xno)
165 AC_MSG_RESULT([$UXA])
166 if test "x$UXA" != "xno"; then
167         AC_DEFINE(USE_UXA, 1, [Enable UXA support])
168         PKG_CHECK_MODULES(DRMINTEL, [libdrm_intel >= 2.4.29])
169 fi
170
171 AC_MSG_CHECKING([whether to include GLAMOR support])
172 AC_ARG_ENABLE(glamor,
173               AS_HELP_STRING([--enable-glamor],
174                              [Enable glamor, a new GL-based acceleration [default=no]]),
175               [GLAMOR="$enableval"],
176               [GLAMOR=no])
177 AC_MSG_RESULT([$GLAMOR])
178 AM_CONDITIONAL(GLAMOR, test x$GLAMOR != xno)
179 if test "x$GLAMOR" != "xno"; then
180         PKG_CHECK_MODULES(LIBGLAMOR, [glamor >= 0.3.1])
181         PKG_CHECK_MODULES(LIBGLAMOR_EGL, [glamor-egl])
182         AC_DEFINE(USE_GLAMOR, 1, [Enable glamor acceleration])
183 fi
184
185
186 PKG_CHECK_MODULES(XORG, [xorg-server >= $required_xorg_xserver_version xproto fontsproto pixman-1 >= $required_pixman_version $REQUIRED_MODULES])
187
188 AC_ARG_ENABLE(xaa,
189               AS_HELP_STRING([--enable-xaa],
190                              [Enable legacy X Acceleration Architecture (XAA) [default=auto]]),
191               [XAA="$enableval"],
192               [XAA=auto])
193 if test "x$XAA" != xno; then
194         save_CFLAGS=$CFLAGS
195         CFLAGS=$XORG_CFLAGS
196         AC_CHECK_HEADERS([xaa.h], XAA=yes, XAA=no)
197         CFLAGS=$save_CFLAGS
198 fi
199 AC_MSG_CHECKING([whether to include XAA support])
200 AM_CONDITIONAL(XAA, test "x$XAA" = xyes)
201 AC_MSG_RESULT([$XAA])
202
203 AC_ARG_ENABLE(dga,
204               AS_HELP_STRING([--enable-dga],
205                              [Enable legacy Direct Graphics Access (DGA) [default=auto]]),
206               [DGA="$enableval"],
207               [DGA=auto])
208 if test "x$DGA" != xno; then
209         save_CFLAGS=$CFLAGS
210         CFLAGS=$XORG_CFLAGS
211         AC_CHECK_HEADERS([dgaproc.h], DGA=yes, DGA=no, [#include <dixstruct.h>])
212         CFLAGS=$save_CFLAGS
213 fi
214 AC_MSG_CHECKING([whether to include DGA support])
215 AM_CONDITIONAL(DGA, test "x$DGA" = xyes)
216 AC_MSG_RESULT([$DGA])
217
218 AC_ARG_WITH(default-accel,
219             AS_HELP_STRING([--with-default-accel],
220                            [Select the default acceleration method [default=uxa if enabled, otherwise sna]]),
221                            [accel="$withval"],
222                            [accel=auto])
223 if test "x$accel" = xyes; then
224         AC_MSG_WARN([No default acceleration specified, choosing automatic selection])
225         accel="auto"
226 fi
227
228 AC_MSG_CHECKING([which acceleration method to use by default])
229 if test "x$accel" = xauto; then
230         if test "x$UXA" != "xno"; then
231                 accel=uxa
232         else
233                 if test "x$SNA" != "xno"; then
234                         accel=sna
235                 fi
236         fi
237         if test "x$accel" = xauto -a "x$UMS_ONLY" != "xyes"; then
238                 AC_MSG_ERROR([No default acceleration option])
239         fi
240 fi
241
242 have_accel=none
243 if test "x$accel" = xsna; then
244         if test "x$SNA" != "xno"; then
245                 AC_DEFINE(DEFAULT_ACCEL_METHOD, SNA, [Default acceleration method])
246                 have_accel=yes
247         else
248                 AC_MSG_ERROR([SNA requested as default, but is not enabled])
249         fi
250 fi
251
252 if test "x$accel" = xuxa; then
253         if test "x$UXA" != "xno"; then
254                 AC_DEFINE(DEFAULT_ACCEL_METHOD, UXA, [Default acceleration method])
255                 have_accel=yes
256         else
257                 AC_MSG_ERROR([UXA requested as default, but is not enabled])
258         fi
259 fi
260 AC_MSG_RESULT($accel)
261 if test "x$accel" = xnone -a "x$UMS_ONLY" != "xyes"; then
262         AC_MSG_ERROR([No default acceleration option])
263 fi
264
265 AC_ARG_ENABLE(userptr,
266               AS_HELP_STRING([--enable-userptr],
267                              [Enable use of userptr (experimental) [default=no]]),
268               [USERPTR="$enableval"],
269               [USERPTR=no])
270 AM_CONDITIONAL(USE_USERPTR, test x$USERPTR = xyes)
271 if test "x$USERPTR" = xyes; then
272         AC_DEFINE(USE_USERPTR,1,[Assume USERPTR support])
273 fi
274
275 AC_ARG_ENABLE(async-swap,
276               AS_HELP_STRING([--enable-async-swap],
277                              [Enable use of asynchronous swaps (experimental) [default=no]]),
278               [ASYNC_SWAP="$enableval"],
279               [ASYNC_SWAP=no])
280 AM_CONDITIONAL(USE_ASYNC_SWAP, test x$ASYNC_SWAP = xyes)
281 if test "x$ASYNC_SWAP" = xyes; then
282         AC_DEFINE(USE_ASYNC_SWAP,1,[Assume asynchronous swap support])
283 fi
284
285 AC_ARG_ENABLE(debug,
286               AS_HELP_STRING([--enable-debug],
287                              [Enables internal debugging [default=no]]),
288               [DEBUG="$enableval"],
289               [DEBUG=no])
290 # Store the list of server defined optional extensions in REQUIRED_MODULES
291 XORG_DRIVER_CHECK_EXT(RANDR, randrproto)
292 XORG_DRIVER_CHECK_EXT(RENDER, renderproto)
293 XORG_DRIVER_CHECK_EXT(XF86DRI, xextproto x11)
294 XORG_DRIVER_CHECK_EXT(DPMSExtension, xextproto)
295
296 # Obtain compiler/linker options for the driver dependencies
297 PKG_CHECK_MODULES(DRM, [libdrm >= 2.4.24]) # libdrm_intel is checked separately
298 PKG_CHECK_MODULES(DRI, [xf86driproto], , DRI=no)
299 PKG_CHECK_MODULES(DRI2, [dri2proto >= 2.6],, DRI2=no)
300 PKG_CHECK_MODULES(PCIACCESS, [pciaccess >= 0.10])
301
302 sdkdir=`$PKG_CONFIG --variable=sdkdir xorg-server`
303
304 if test "x$enable_dri" != "xno"; then
305         save_CFLAGS="$CFLAGS"
306         save_CPPFLAGS="$CPPFLAGS"
307         CFLAGS="$CFLAGS $XORG_CFLAGS $DRI_CFLAGS $DRM_CFLAGS"
308         CPPFLAGS="$CPPFLAGS $XORG_CFLAGS $DRI_CFLAGS $DRM_CFLAGS"
309         AC_CHECK_HEADERS([dri.h sarea.h dristruct.h],, [DRI=no],
310                 [/* for dri.h */
311                  #include <xf86str.h>
312                  /* for dristruct.h */
313                  #include <xorg-server.h>
314                  #ifdef HAVE_DRI_H
315                  # include <dri.h>
316                  #endif
317                  #ifdef HAVE_SAREA_H
318                  # include <sarea.h>
319                  #endif
320                 ])
321         CFLAGS="$save_CFLAGS $DEBUGFLAGS"
322         CPPFLAGS="$save_CPPFLAGS"
323 else
324         DRI=no
325 fi
326
327 AC_MSG_CHECKING([whether to include DRI support])
328 AC_MSG_RESULT([${DRI-yes}])
329
330 AM_CONDITIONAL(DRI, test x$DRI != xno)
331 if test "x$DRI" != "xno"; then
332         AC_DEFINE(HAVE_DRI1,1,[Enable DRI driver support])
333 else
334         DRI_CFLAGS=""
335         DRI_LIBS=""
336
337         if test "x$enable_dri" = "xyes"; then
338                 AC_MSG_ERROR([DRI requested but prerequisites not found])
339         fi
340 fi
341
342 if test "x$DRI2" != "xno"; then
343         save_CFLAGS=$CFLAGS
344         CFLAGS="$XORG_CFLAGS $DRM_CFLAGS $DRI_CFLAGS $DRI2_CFLAGS"
345         AC_CHECK_HEADERS([dri2.h], DRI2=yes, DRI2=no, [#include <dixstruct.h>])
346         CFLAGS=$save_CFLAGS
347 fi
348 AC_MSG_CHECKING([whether to include DRI2 support])
349 AM_CONDITIONAL(DRI2, test "x$DRI2" = xyes)
350 AC_MSG_RESULT([$DRI2])
351
352 if test "$XVMC" = yes; then
353         PKG_CHECK_MODULES(XVMCLIB,
354                           [xvmc xext xfixes dri2proto x11-xcb xcb-dri2 xcb-aux],
355                           [XVMC=yes], [XVMC=no])
356 fi
357 AC_MSG_CHECKING([whether to include XvMC support])
358 AC_MSG_RESULT([$XVMC])
359 AM_CONDITIONAL(XVMC, test x$XVMC = xyes)
360 if test "x$XVMC" = xyes; then
361         AC_DEFINE(ENABLE_XVMC,1,[Enable XvMC support])
362 fi
363
364 AM_CONDITIONAL(KMS_ONLY, test x$KMS_ONLY = xyes)
365 if test "x$KMS_ONLY" = xyes; then
366         AC_DEFINE(KMS_ONLY,1,[Assume KMS support])
367 fi
368 AM_CONDITIONAL(UMS_ONLY, test x$UMS_ONLY = xyes)
369 if test "x$UMS_ONLY" = xyes; then
370         AC_DEFINE(UMS_ONLY,1,[Assume only UMS (no KMS) support])
371 fi
372
373 AM_CONDITIONAL(DEBUG, test x$DEBUG != xno)
374 AM_CONDITIONAL(FULL_DEBUG, test x$FULL_DEBUG == xfull)
375 if test "x$DEBUG" = xno; then
376         AC_DEFINE(NDEBUG,1,[Disable internal debugging])
377 fi
378 if test "x$DEBUG" != xno; then
379         PKG_CHECK_MODULES(VALGRIND, [valgrind], have_valgrind=yes, have_valgrind=no)
380         if test x$have_valgrind = xyes; then
381                 AC_DEFINE([HAVE_VALGRIND], 1, [Use valgrind intrinsics to suppress false warnings])
382         fi
383 fi
384 if test "x$DEBUG" = xmemory; then
385         AC_DEFINE(DEBUG_MEMORY,1,[Enable memory debugging])
386 fi
387 if test "x$DEBUG" = xpixmap; then
388         AC_DEFINE(DEBUG_PIXMAP,1,[Enable pixmap debugging])
389 fi
390 if test "x$DEBUG" = xfull; then
391         AC_DEFINE(DEBUG_MEMORY,1,[Enable memory debugging])
392         AC_DEFINE(DEBUG_PIXMAP,1,[Enable pixmap debugging])
393         AC_DEFINE(HAS_DEBUG_FULL,1,[Enable all debugging])
394         CFLAGS="$CFLAGS -O0 -ggdb3"
395 fi
396
397 DRIVER_NAME=intel
398 AC_SUBST([DRIVER_NAME])
399 AC_SUBST([moduledir])
400
401 AC_CONFIG_FILES([
402                 Makefile
403                 uxa/Makefile
404                 src/Makefile
405                 src/xvmc/Makefile
406                 src/xvmc/shader/Makefile
407                 src/xvmc/shader/mc/Makefile
408                 src/xvmc/shader/vld/Makefile
409                 src/legacy/Makefile
410                 src/legacy/i810/Makefile
411                 src/legacy/i810/xvmc/Makefile
412                 src/sna/Makefile
413                 src/sna/brw/Makefile
414                 src/sna/fb/Makefile
415                 man/Makefile
416                 src/render_program/Makefile
417                 test/Makefile
418 ])
419 AC_OUTPUT