nvc0: delete compute object on screen destruction
[mesa.git] / configure.ac
1 dnl Process this file with autoconf to create configure.
2
3 AC_PREREQ([2.60])
4
5 dnl Tell the user about autoconf.html in the --help output
6 m4_divert_once([HELP_END], [
7 See docs/autoconf.html for more details on the options for Mesa.])
8
9 m4_define(MESA_VERSION, m4_normalize(m4_include(VERSION)))
10 AC_INIT([Mesa], [MESA_VERSION],
11 [https://bugs.freedesktop.org/enter_bug.cgi?product=Mesa])
12 AC_CONFIG_AUX_DIR([bin])
13 AC_CONFIG_MACRO_DIR([m4])
14 AC_CANONICAL_SYSTEM
15 AM_INIT_AUTOMAKE([foreign])
16
17 dnl http://people.gnome.org/~walters/docs/build-api.txt
18 dnl We don't support srcdir != builddir.
19 echo \#buildapi-variable-no-builddir >/dev/null
20
21 # Support silent build rules, requires at least automake-1.11. Disable
22 # by either passing --disable-silent-rules to configure or passing V=1
23 # to make
24 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
25 [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
26
27 m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
28
29 dnl Set internal versions
30 OSMESA_VERSION=8
31 AC_SUBST([OSMESA_VERSION])
32
33 dnl Versions for external dependencies
34 LIBDRM_REQUIRED=2.4.24
35 LIBDRM_RADEON_REQUIRED=2.4.46
36 LIBDRM_INTEL_REQUIRED=2.4.38
37 LIBDRM_NVVIEUX_REQUIRED=2.4.33
38 LIBDRM_NOUVEAU_REQUIRED="2.4.33 libdrm >= 2.4.41"
39 LIBDRM_FREEDRENO_REQUIRED=2.4.39
40 DRI2PROTO_REQUIRED=2.6
41 GLPROTO_REQUIRED=1.4.14
42 LIBDRM_XORG_REQUIRED=2.4.24
43 LIBKMS_XORG_REQUIRED=1.0.0
44
45 dnl Check for progs
46 AC_PROG_CPP
47 AC_PROG_CC
48 AX_PROG_CC_FOR_BUILD
49 AC_PROG_CXX
50 AX_PROG_CXX_FOR_BUILD
51 AM_PROG_CC_C_O
52 AM_PROG_AS
53 AC_CHECK_PROGS([MAKE], [gmake make])
54 AC_CHECK_PROGS([PYTHON2], [python2 python])
55 AX_PYTHON_MODULE([libxml2], [needed])
56 AC_PROG_SED
57 AC_PROG_MKDIR_P
58
59 LT_PREREQ([2.2])
60 LT_INIT([disable-static])
61
62 AX_PROG_BISON([],
63 AS_IF([test ! -f "$srcdir/src/glsl/glcpp/glcpp-parse.c"],
64 [AC_MSG_ERROR([bison not found - unable to compile glcpp-parse.y])]))
65 AX_PROG_FLEX([],
66 AS_IF([test ! -f "$srcdir/src/glsl/glcpp/glcpp-lex.c"],
67 [AC_MSG_ERROR([flex not found - unable to compile glcpp-lex.l])]))
68
69 AC_PATH_PROG([PERL], [perl])
70
71 AC_CHECK_PROG(INDENT, indent, indent, cat)
72 if test "x$INDENT" != "xcat"; then
73 AC_SUBST(INDENT_FLAGS, '-i4 -nut -br -brs -npcs -ce -TGLubyte -TGLbyte -TBool')
74 fi
75
76 AC_PROG_INSTALL
77
78 dnl We need a POSIX shell for parts of the build. Assume we have one
79 dnl in most cases.
80 case "$host_os" in
81 solaris*)
82 # Solaris /bin/sh is too old/non-POSIX compliant
83 AC_PATH_PROGS(POSIX_SHELL, [ksh93 ksh sh])
84 SHELL="$POSIX_SHELL"
85 ;;
86 esac
87
88 dnl clang is mostly GCC-compatible, but its version is much lower,
89 dnl so we have to check for it.
90 AC_MSG_CHECKING([if compiling with clang])
91
92 AC_COMPILE_IFELSE(
93 [AC_LANG_PROGRAM([], [[
94 #ifndef __clang__
95 not clang
96 #endif
97 ]])],
98 [acv_mesa_CLANG=yes], [acv_mesa_CLANG=no])
99
100 AC_MSG_RESULT([$acv_mesa_CLANG])
101
102 dnl If we're using GCC, make sure that it is at least version 3.3.0. Older
103 dnl versions are explictly not supported.
104 GEN_ASM_OFFSETS=no
105 if test "x$GCC" = xyes -a "x$acv_mesa_CLANG" = xno; then
106 AC_MSG_CHECKING([whether gcc version is sufficient])
107 major=0
108 minor=0
109
110 GCC_VERSION=`$CC -dumpversion`
111 if test $? -eq 0; then
112 GCC_VERSION_MAJOR=`echo $GCC_VERSION | cut -d. -f1`
113 GCC_VERSION_MINOR=`echo $GCC_VERSION | cut -d. -f2`
114 fi
115
116 if test $GCC_VERSION_MAJOR -lt 3 -o $GCC_VERSION_MAJOR -eq 3 -a $GCC_VERSION_MINOR -lt 3 ; then
117 AC_MSG_RESULT([no])
118 AC_MSG_ERROR([If using GCC, version 3.3.0 or later is required.])
119 else
120 AC_MSG_RESULT([yes])
121 fi
122
123 if test "x$cross_compiling" = xyes; then
124 GEN_ASM_OFFSETS=yes
125 fi
126 fi
127 AM_CONDITIONAL([GEN_ASM_OFFSETS], test "x$GEN_ASM_OFFSETS" = xyes)
128
129 dnl Make sure the pkg-config macros are defined
130 m4_ifndef([PKG_PROG_PKG_CONFIG],
131 [m4_fatal([Could not locate the pkg-config autoconf macros.
132 These are usually located in /usr/share/aclocal/pkg.m4. If your macros
133 are in a different location, try setting the environment variable
134 ACLOCAL="aclocal -I/other/macro/dir" before running autoreconf.])])
135 PKG_PROG_PKG_CONFIG()
136
137 dnl LIB_DIR - library basename
138 LIB_DIR=`echo $libdir | $SED 's%.*/%%'`
139 AC_SUBST([LIB_DIR])
140
141 dnl Cache LDFLAGS and CPPFLAGS so we can add to them and restore later
142 _SAVE_LDFLAGS="$LDFLAGS"
143 _SAVE_CPPFLAGS="$CPPFLAGS"
144
145 dnl build host compiler macros
146 DEFINES_FOR_BUILD=""
147 AC_SUBST([DEFINES_FOR_BUILD])
148 case "$build_os" in
149 linux*|*-gnu*|gnu*)
150 DEFINES_FOR_BUILD="$DEFINES_FOR_BUILD -D_GNU_SOURCE"
151 ;;
152 solaris*)
153 DEFINES_FOR_BUILD="$DEFINES_FOR_BUILD -DSVR4"
154 ;;
155 cygwin*)
156 DEFINES_FOR_BUILD="$DEFINES_FOR_BUILD"
157 ;;
158 esac
159
160 dnl Compiler macros
161 DEFINES=""
162 AC_SUBST([DEFINES])
163 case "$host_os" in
164 linux*|*-gnu*|gnu*)
165 DEFINES="$DEFINES -D_GNU_SOURCE -DHAVE_PTHREAD"
166 ;;
167 solaris*)
168 DEFINES="$DEFINES -DHAVE_PTHREAD -DSVR4"
169 ;;
170 cygwin*)
171 DEFINES="$DEFINES -DHAVE_PTHREAD"
172 ;;
173 esac
174
175 dnl Add flags for gcc and g++
176 if test "x$GCC" = xyes; then
177 case "$host_os" in
178 cygwin*)
179 CFLAGS="$CFLAGS -Wall -std=gnu99"
180 ;;
181 *)
182 CFLAGS_FOR_BUILD="$CFLAGS_FOR_BUILD -Wall -std=c99"
183 CFLAGS="$CFLAGS -Wall -std=c99"
184 ;;
185 esac
186
187 # Enable -Werror=implicit-function-declaration and
188 # -Werror=missing-prototypes, if available, or otherwise, just
189 # -Wmissing-prototypes. This is particularly useful to avoid
190 # generating a loadable driver module that has undefined symbols.
191 save_CFLAGS="$CFLAGS"
192 AC_MSG_CHECKING([whether $CC supports -Werror=missing-prototypes])
193 CFLAGS="$CFLAGS -Werror=implicit-function-declaration"
194 CFLAGS="$CFLAGS -Werror=missing-prototypes"
195 AC_LINK_IFELSE([AC_LANG_PROGRAM()],
196 AC_MSG_RESULT([yes]),
197 [CFLAGS="$save_CFLAGS -Wmissing-prototypes";
198 AC_MSG_RESULT([no])]);
199
200 # Enable -fvisibility=hidden if using a gcc that supports it
201 save_CFLAGS="$CFLAGS"
202 AC_MSG_CHECKING([whether $CC supports -fvisibility=hidden])
203 VISIBILITY_CFLAGS="-fvisibility=hidden"
204 CFLAGS="$CFLAGS $VISIBILITY_CFLAGS"
205 AC_LINK_IFELSE([AC_LANG_PROGRAM()], AC_MSG_RESULT([yes]),
206 [VISIBILITY_CFLAGS=""; AC_MSG_RESULT([no])]);
207
208 # Restore CFLAGS; VISIBILITY_CFLAGS are added to it where needed.
209 CFLAGS=$save_CFLAGS
210
211 # Work around aliasing bugs - developers should comment this out
212 CFLAGS_FOR_BUILD="$CFLAGS_FOR_BUILD -fno-strict-aliasing"
213 CFLAGS="$CFLAGS -fno-strict-aliasing"
214
215 # gcc's builtin memcmp is slower than glibc's
216 # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43052
217 CFLAGS_FOR_BUILD="$CFLAGS_FOR_BUILD -fno-builtin-memcmp"
218 CFLAGS="$CFLAGS -fno-builtin-memcmp"
219 fi
220 if test "x$GXX" = xyes; then
221 CXXFLAGS_FOR_BUILD="$CXXFLAGS_FOR_BUILD -Wall"
222 CXXFLAGS="$CXXFLAGS -Wall"
223
224 # Enable -fvisibility=hidden if using a gcc that supports it
225 save_CXXFLAGS="$CXXFLAGS"
226 AC_MSG_CHECKING([whether $CXX supports -fvisibility=hidden])
227 VISIBILITY_CXXFLAGS="-fvisibility=hidden"
228 CXXFLAGS="$CXXFLAGS $VISIBILITY_CXXFLAGS"
229 AC_LANG_PUSH([C++])
230 AC_LINK_IFELSE([AC_LANG_PROGRAM()], AC_MSG_RESULT([yes]),
231 [VISIBILITY_CXXFLAGS="" ; AC_MSG_RESULT([no])]);
232 AC_LANG_POP([C++])
233
234 # Restore CXXFLAGS; VISIBILITY_CXXFLAGS are added to it where needed.
235 CXXFLAGS=$save_CXXFLAGS
236
237 # Work around aliasing bugs - developers should comment this out
238 CXXFLAGS_FOR_BUILD="$CXXFLAGS_FOR_BUILD -fno-strict-aliasing"
239 CXXFLAGS="$CXXFLAGS -fno-strict-aliasing"
240
241 # gcc's builtin memcmp is slower than glibc's
242 # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43052
243 CXXFLAGS_FOR_BUILD="$CXXFLAGS_FOR_BUILD -fno-builtin-memcmp"
244 CXXFLAGS="$CXXFLAGS -fno-builtin-memcmp"
245 fi
246
247 dnl even if the compiler appears to support it, using visibility attributes isn't
248 dnl going to do anything useful currently on cygwin apart from emit lots of warnings
249 case "$host_os" in
250 cygwin*)
251 VISIBILITY_CFLAGS=""
252 VISIBILITY_CXXFLAGS=""
253 ;;
254 esac
255
256 AC_SUBST([VISIBILITY_CFLAGS])
257 AC_SUBST([VISIBILITY_CXXFLAGS])
258
259 dnl
260 dnl Hacks to enable 32 or 64 bit build
261 dnl
262 AC_ARG_ENABLE([32-bit],
263 [AS_HELP_STRING([--enable-32-bit],
264 [build 32-bit libraries @<:@default=auto@:>@])],
265 [enable_32bit="$enableval"],
266 [enable_32bit=auto]
267 )
268 if test "x$enable_32bit" = xyes; then
269 if test "x$GCC" = xyes; then
270 CFLAGS="$CFLAGS -m32"
271 CCASFLAGS="$CCASFLAGS -m32"
272 fi
273 if test "x$GXX" = xyes; then
274 CXXFLAGS="$CXXFLAGS -m32"
275 fi
276 fi
277 AC_ARG_ENABLE([64-bit],
278 [AS_HELP_STRING([--enable-64-bit],
279 [build 64-bit libraries @<:@default=auto@:>@])],
280 [enable_64bit="$enableval"],
281 [enable_64bit=auto]
282 )
283 if test "x$enable_64bit" = xyes; then
284 if test "x$GCC" = xyes; then
285 CFLAGS="$CFLAGS -m64"
286 fi
287 if test "x$GXX" = xyes; then
288 CXXFLAGS="$CXXFLAGS -m64"
289 fi
290 fi
291
292 dnl Can't have static and shared libraries, default to static if user
293 dnl explicitly requested. If both disabled, set to static since shared
294 dnl was explicitly requested.
295 case "x$enable_static$enable_shared" in
296 xyesyes )
297 AC_MSG_WARN([Cannot build static and shared libraries, disabling shared])
298 enable_shared=no
299 ;;
300 xnono )
301 AC_MSG_WARN([Cannot disable both static and shared libraries, enabling static])
302 enable_static=yes
303 ;;
304 esac
305
306 AM_CONDITIONAL(BUILD_SHARED, test "x$enable_shared" = xyes)
307
308 dnl
309 dnl other compiler options
310 dnl
311 AC_ARG_ENABLE([debug],
312 [AS_HELP_STRING([--enable-debug],
313 [use debug compiler flags and macros @<:@default=disabled@:>@])],
314 [enable_debug="$enableval"],
315 [enable_debug=no]
316 )
317 if test "x$enable_debug" = xyes; then
318 DEFINES_FOR_BUILD="$DEFINES_FOR_BUILD -DDEBUG"
319 if test "x$GCC_FOR_BUILD" = xyes; then
320 CFLAGS_FOR_BUILD="$CFLAGS_FOR_BUILD -g -O0"
321 fi
322 if test "x$GXX_FOR_BUILD" = xyes; then
323 CXXFLAGS_FOR_BUILD="$CXXFLAGS_FOR_BUILD -g -O0"
324 fi
325
326 DEFINES="$DEFINES -DDEBUG"
327 if test "x$GCC" = xyes; then
328 CFLAGS="$CFLAGS -g -O0"
329 fi
330 if test "x$GXX" = xyes; then
331 CXXFLAGS="$CXXFLAGS -g -O0"
332 fi
333 fi
334
335 dnl
336 dnl library names
337 dnl
338 LIB_PREFIX_GLOB='lib'
339 LIB_VERSION_SEPARATOR='.'
340 if test "$enable_static" = yes; then
341 LIB_EXTENSION='a'
342 else
343 case "$host_os" in
344 darwin* )
345 LIB_EXTENSION='dylib' ;;
346 cygwin* )
347 dnl prefix can be 'cyg' or 'lib'
348 LIB_PREFIX_GLOB='???'
349 LIB_VERSION_SEPARATOR='-'
350 LIB_EXTENSION='dll' ;;
351 aix* )
352 LIB_EXTENSION='a' ;;
353 * )
354 LIB_EXTENSION='so' ;;
355 esac
356 fi
357 AC_ARG_WITH([gl-lib-name],
358 [AS_HELP_STRING([--with-gl-lib-name@<:@=NAME@:>@],
359 [specify GL library name @<:@default=GL@:>@])],
360 [GL_LIB=$withval],
361 [GL_LIB=GL])
362 AC_ARG_WITH([osmesa-lib-name],
363 [AS_HELP_STRING([--with-osmesa-lib-name@<:@=NAME@:>@],
364 [specify OSMesa library name @<:@default=OSMesa@:>@])],
365 [OSMESA_LIB=$withval],
366 [OSMESA_LIB=OSMesa])
367 AS_IF([test "x$GL_LIB" = xyes], [GL_LIB=GL])
368 AS_IF([test "x$OSMESA_LIB" = xyes], [OSMESA_LIB=OSMesa])
369
370 dnl
371 dnl Mangled Mesa support
372 dnl
373 AC_ARG_ENABLE([mangling],
374 [AS_HELP_STRING([--enable-mangling],
375 [enable mangled symbols and library name @<:@default=disabled@:>@])],
376 [enable_mangling="${enableval}"],
377 [enable_mangling=no]
378 )
379 if test "x${enable_mangling}" = "xyes" ; then
380 DEFINES="${DEFINES} -DUSE_MGL_NAMESPACE"
381 GL_LIB="Mangled${GL_LIB}"
382 OSMESA_LIB="Mangled${OSMESA_LIB}"
383 fi
384 AC_SUBST([GL_LIB])
385 AC_SUBST([OSMESA_LIB])
386
387 dnl
388 dnl potentially-infringing-but-nobody-knows-for-sure stuff
389 dnl
390 AC_ARG_ENABLE([texture-float],
391 [AS_HELP_STRING([--enable-texture-float],
392 [enable floating-point textures and renderbuffers @<:@default=disabled@:>@])],
393 [enable_texture_float="$enableval"],
394 [enable_texture_float=no]
395 )
396 if test "x$enable_texture_float" = xyes; then
397 AC_MSG_WARN([Floating-point textures enabled.])
398 AC_MSG_WARN([Please consult docs/patents.txt with your lawyer before building Mesa.])
399 DEFINES="$DEFINES -DTEXTURE_FLOAT_ENABLED"
400 fi
401
402 GL_LIB_NAME='lib$(GL_LIB).'${LIB_EXTENSION}
403 OSMESA_LIB_NAME='lib$(OSMESA_LIB).'${LIB_EXTENSION}
404 EGL_LIB_NAME='lib$(EGL_LIB).'${LIB_EXTENSION}
405 GLESv1_CM_LIB_NAME='lib$(GLESv1_CM_LIB).'${LIB_EXTENSION}
406 GLESv2_LIB_NAME='lib$(GLESv2_LIB).'${LIB_EXTENSION}
407 VG_LIB_NAME='lib$(VG_LIB).'${LIB_EXTENSION}
408 GLAPI_LIB_NAME='lib$(GLAPI_LIB).'${LIB_EXTENSION}
409
410 GL_LIB_GLOB=${LIB_PREFIX_GLOB}'$(GL_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
411 EGL_LIB_GLOB=${LIB_PREFIX_GLOB}'$(EGL_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
412 EGL_LIB_GLOB=${LIB_PREFIX_GLOB}'$(EGL_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
413 GLESv1_CM_LIB_GLOB=${LIB_PREFIX_GLOB}'$(GLESv1_CM_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
414 GLESv2_LIB_GLOB=${LIB_PREFIX_GLOB}'$(GLESv2_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
415 VG_LIB_GLOB=${LIB_PREFIX_GLOB}'$(VG_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
416 GLAPI_LIB_GLOB=${LIB_PREFIX_GLOB}'$(GLAPI_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
417
418 AC_SUBST([GL_LIB_NAME])
419 AC_SUBST([OSMESA_LIB_NAME])
420 AC_SUBST([EGL_LIB_NAME])
421 AC_SUBST([GLESv1_CM_LIB_NAME])
422 AC_SUBST([GLESv2_LIB_NAME])
423 AC_SUBST([VG_LIB_NAME])
424 AC_SUBST([GLAPI_LIB_NAME])
425
426 AC_SUBST([GL_LIB_GLOB])
427 AC_SUBST([EGL_LIB_GLOB])
428 AC_SUBST([GLESv1_CM_LIB_GLOB])
429 AC_SUBST([GLESv2_LIB_GLOB])
430 AC_SUBST([VG_LIB_GLOB])
431 AC_SUBST([GLAPI_LIB_GLOB])
432
433 dnl
434 dnl Arch/platform-specific settings
435 dnl
436 AC_ARG_ENABLE([asm],
437 [AS_HELP_STRING([--disable-asm],
438 [disable assembly usage @<:@default=enabled on supported plaforms@:>@])],
439 [enable_asm="$enableval"],
440 [enable_asm=yes]
441 )
442 asm_arch=""
443 AC_MSG_CHECKING([whether to enable assembly])
444 test "x$enable_asm" = xno && AC_MSG_RESULT([no])
445 # disable if cross compiling on x86/x86_64 since we must run gen_matypes
446 if test "x$enable_asm" = xyes && test "x$cross_compiling" = xyes; then
447 case "$host_cpu" in
448 i?86 | x86_64 | amd64)
449 enable_asm=no
450 AC_MSG_RESULT([no, cross compiling])
451 ;;
452 esac
453 fi
454 # check for supported arches
455 if test "x$enable_asm" = xyes; then
456 case "$host_cpu" in
457 i?86)
458 case "$host_os" in
459 linux* | *freebsd* | dragonfly* | *netbsd* | openbsd*)
460 test "x$enable_64bit" = xyes && asm_arch=x86_64 || asm_arch=x86
461 ;;
462 gnu*)
463 asm_arch=x86
464 ;;
465 esac
466 ;;
467 x86_64|amd64)
468 case "$host_os" in
469 linux* | *freebsd* | dragonfly* | *netbsd* | openbsd*)
470 test "x$enable_32bit" = xyes && asm_arch=x86 || asm_arch=x86_64
471 ;;
472 esac
473 ;;
474 sparc*)
475 case "$host_os" in
476 linux*)
477 asm_arch=sparc
478 ;;
479 esac
480 ;;
481 esac
482
483 case "$asm_arch" in
484 x86)
485 DEFINES="$DEFINES -DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM"
486 AC_MSG_RESULT([yes, x86])
487 ;;
488 x86_64|amd64)
489 DEFINES="$DEFINES -DUSE_X86_64_ASM"
490 AC_MSG_RESULT([yes, x86_64])
491 ;;
492 sparc)
493 DEFINES="$DEFINES -DUSE_SPARC_ASM"
494 AC_MSG_RESULT([yes, sparc])
495 ;;
496 *)
497 AC_MSG_RESULT([no, platform not supported])
498 ;;
499 esac
500 fi
501
502 dnl Check to see if dlopen is in default libraries (like Solaris, which
503 dnl has it in libc), or if libdl is needed to get it.
504 AC_CHECK_FUNC([dlopen], [DEFINES="$DEFINES -DHAVE_DLOPEN"],
505 [AC_CHECK_LIB([dl], [dlopen],
506 [DEFINES="$DEFINES -DHAVE_DLOPEN"; DLOPEN_LIBS="-ldl"])])
507 AC_SUBST([DLOPEN_LIBS])
508
509 case "$host_os" in
510 darwin*|mingw*)
511 ;;
512 *)
513 AC_CHECK_FUNCS([clock_gettime], [CLOCK_LIB=],
514 [AC_CHECK_LIB([rt], [clock_gettime], [CLOCK_LIB=-lrt],
515 [AC_MSG_ERROR([Couldn't find clock_gettime])])])
516 AC_SUBST([CLOCK_LIB])
517 ;;
518 esac
519
520 dnl See if posix_memalign is available
521 AC_CHECK_FUNC([posix_memalign], [DEFINES="$DEFINES -DHAVE_POSIX_MEMALIGN"])
522
523 dnl Check for pthreads
524 AX_PTHREAD
525 dnl AX_PTHREADS leaves PTHREAD_LIBS empty for gcc and sets PTHREAD_CFLAGS
526 dnl to -pthread, which causes problems if we need -lpthread to appear in
527 dnl pkgconfig files.
528 test -z "$PTHREAD_LIBS" && PTHREAD_LIBS="-lpthread"
529
530 dnl SELinux awareness.
531 AC_ARG_ENABLE([selinux],
532 [AS_HELP_STRING([--enable-selinux],
533 [Build SELinux-aware Mesa @<:@default=disabled@:>@])],
534 [MESA_SELINUX="$enableval"],
535 [MESA_SELINUX=no])
536 if test "x$enable_selinux" = "xyes"; then
537 AC_CHECK_HEADER([selinux/selinux.h],[],
538 [AC_MSG_ERROR([SELinux headers not found])])
539 AC_CHECK_LIB([selinux],[is_selinux_enabled],[],
540 [AC_MSG_ERROR([SELinux library not found])])
541 SELINUX_LIBS="-lselinux"
542 DEFINES="$DEFINES -DMESA_SELINUX"
543 fi
544 AC_SUBST([SELINUX_LIBS])
545
546 dnl Options for APIs
547 AC_ARG_ENABLE([opengl],
548 [AS_HELP_STRING([--disable-opengl],
549 [disable support for standard OpenGL API @<:@default=no@:>@])],
550 [enable_opengl="$enableval"],
551 [enable_opengl=yes])
552 AC_ARG_ENABLE([gles1],
553 [AS_HELP_STRING([--enable-gles1],
554 [enable support for OpenGL ES 1.x API @<:@default=no@:>@])],
555 [enable_gles1="$enableval"],
556 [enable_gles1=no])
557 AC_ARG_ENABLE([gles2],
558 [AS_HELP_STRING([--enable-gles2],
559 [enable support for OpenGL ES 2.x API @<:@default=no@:>@])],
560 [enable_gles2="$enableval"],
561 [enable_gles2=no])
562 AC_ARG_ENABLE([openvg],
563 [AS_HELP_STRING([--enable-openvg],
564 [enable support for OpenVG API @<:@default=no@:>@])],
565 [enable_openvg="$enableval"],
566 [enable_openvg=no])
567
568 AC_ARG_ENABLE([dri],
569 [AS_HELP_STRING([--enable-dri],
570 [enable DRI modules @<:@default=enabled@:>@])],
571 [enable_dri="$enableval"],
572 [enable_dri=yes])
573 AC_ARG_ENABLE([glx],
574 [AS_HELP_STRING([--enable-glx],
575 [enable GLX library @<:@default=enabled@:>@])],
576 [enable_glx="$enableval"],
577 [enable_glx=yes])
578 AC_ARG_ENABLE([osmesa],
579 [AS_HELP_STRING([--enable-osmesa],
580 [enable OSMesa library @<:@default=disabled@:>@])],
581 [enable_osmesa="$enableval"],
582 [enable_osmesa=no])
583 AC_ARG_ENABLE([gallium-osmesa],
584 [AS_HELP_STRING([--enable-gallium-osmesa],
585 [enable Gallium implementation of the OSMesa library @<:@default=disabled@:>@])],
586 [enable_gallium_osmesa="$enableval"],
587 [enable_gallium_osmesa=no])
588 AC_ARG_ENABLE([egl],
589 [AS_HELP_STRING([--disable-egl],
590 [disable EGL library @<:@default=enabled@:>@])],
591 [enable_egl="$enableval"],
592 [enable_egl=yes])
593
594 AC_ARG_ENABLE([xorg],
595 [AS_HELP_STRING([--enable-xorg],
596 [enable support for X.Org DDX API @<:@default=no@:>@])],
597 [enable_xorg="$enableval"],
598 [enable_xorg=no])
599 AC_ARG_ENABLE([xa],
600 [AS_HELP_STRING([--enable-xa],
601 [enable build of the XA X Acceleration API @<:@default=no@:>@])],
602 [enable_xa="$enableval"],
603 [enable_xa=no])
604 AC_ARG_ENABLE([gbm],
605 [AS_HELP_STRING([--enable-gbm],
606 [enable gbm library @<:@default=auto@:>@])],
607 [enable_gbm="$enableval"],
608 [enable_gbm=auto])
609
610 AC_ARG_ENABLE([xvmc],
611 [AS_HELP_STRING([--enable-xvmc],
612 [enable xvmc library @<:@default=auto@:>@])],
613 [enable_xvmc="$enableval"],
614 [enable_xvmc=auto])
615 AC_ARG_ENABLE([vdpau],
616 [AS_HELP_STRING([--enable-vdpau],
617 [enable vdpau library @<:@default=auto@:>@])],
618 [enable_vdpau="$enableval"],
619 [enable_vdpau=auto])
620 AC_ARG_ENABLE([opencl],
621 [AS_HELP_STRING([--enable-opencl],
622 [enable OpenCL library NOTE: Enabling this option will also enable
623 --with-llvm-shared-libs
624 @<:@default=no@:>@])],
625 [],
626 [enable_opencl=no])
627 AC_ARG_ENABLE([xlib-glx],
628 [AS_HELP_STRING([--enable-xlib-glx],
629 [make GLX library Xlib-based instead of DRI-based @<:@default=disabled@:>@])],
630 [enable_xlib_glx="$enableval"],
631 [enable_xlib_glx=no])
632 AC_ARG_ENABLE([gallium-egl],
633 [AS_HELP_STRING([--enable-gallium-egl],
634 [enable optional EGL state tracker (not required
635 for EGL support in Gallium with OpenGL and OpenGL ES)
636 @<:@default=disable@:>@])],
637 [enable_gallium_egl="$enableval"],
638 [enable_gallium_egl=no])
639 AC_ARG_ENABLE([gallium-gbm],
640 [AS_HELP_STRING([--enable-gallium-gbm],
641 [enable optional gbm state tracker (not required for
642 gbm support in Gallium)
643 @<:@default=auto@:>@])],
644 [enable_gallium_gbm="$enableval"],
645 [enable_gallium_gbm=auto])
646
647 AC_ARG_ENABLE([r600-llvm-compiler],
648 [AS_HELP_STRING([--enable-r600-llvm-compiler],
649 [Enable experimental LLVM backend for graphics shaders @<:@default=disable@:>@])],
650 [enable_r600_llvm="$enableval"],
651 [enable_r600_llvm=no])
652
653 AC_ARG_ENABLE([gallium-tests],
654 [AS_HELP_STRING([--enable-gallium-tests],
655 [Enable optional Gallium tests) @<:@default=disable@:>@])],
656 [enable_gallium_tests="$enableval"],
657 [enable_gallium_tests=no])
658
659 # Option for Gallium drivers
660
661 # Keep this in sync with the --with-gallium-drivers help string default value
662 GALLIUM_DRIVERS_DEFAULT="r300,r600,svga,swrast"
663
664 AC_ARG_WITH([gallium-drivers],
665 [AS_HELP_STRING([--with-gallium-drivers@<:@=DIRS...@:>@],
666 [comma delimited Gallium drivers list, e.g.
667 "i915,ilo,nouveau,r300,r600,radeonsi,freedreno,svga,swrast"
668 @<:@default=r300,r600,svga,swrast@:>@])],
669 [with_gallium_drivers="$withval"],
670 [with_gallium_drivers="$GALLIUM_DRIVERS_DEFAULT"])
671
672 # Doing '--without-gallium-drivers' will set this variable to 'no'. Clear it
673 # here so that the script doesn't choke on an unknown driver name later.
674 case "$with_gallium_drivers" in
675 yes) with_gallium_drivers="$GALLIUM_DRIVERS_DEFAULT" ;;
676 no) with_gallium_drivers='' ;;
677 esac
678
679 if test "x$enable_opengl" = xno -a \
680 "x$enable_gles1" = xno -a \
681 "x$enable_gles2" = xno -a \
682 "x$enable_openvg" = xno -a \
683 "x$enable_xorg" = xno -a \
684 "x$enable_xa" = xno -a \
685 "x$enable_xvmc" = xno -a \
686 "x$enable_vdpau" = xno -a \
687 "x$enable_opencl" = xno; then
688 AC_MSG_ERROR([at least one API should be enabled])
689 fi
690
691 # Building OpenGL ES1 and/or ES2 without OpenGL is not supported on mesa 9.0.x
692 if test "x$enable_opengl" = xno -a \
693 "x$enable_gles1" = xyes; then
694 AC_MSG_ERROR([Building OpenGL ES1 without OpenGL is not supported])
695 fi
696
697 if test "x$enable_opengl" = xno -a \
698 "x$enable_gles2" = xyes; then
699 AC_MSG_ERROR([Building OpenGL ES2 without OpenGL is not supported])
700 fi
701
702 AM_CONDITIONAL(HAVE_OPENGL, test "x$enable_opengl" = xyes)
703 AM_CONDITIONAL(HAVE_OPENGL_ES1, test "x$enable_gles1" = xyes)
704 AM_CONDITIONAL(HAVE_OPENGL_ES2, test "x$enable_gles2" = xyes)
705 AM_CONDITIONAL(NEED_OPENGL_COMMON, test "x$enable_opengl" = xyes -o \
706 "x$enable_gles1" = xyes -o \
707 "x$enable_gles2" = xyes)
708
709 if test "x$enable_glx" = xno; then
710 AC_MSG_WARN([GLX disabled, disabling Xlib-GLX])
711 enable_xlib_glx=no
712 fi
713
714 if test "x$enable_dri$enable_xlib_glx" = xyesyes; then
715 AC_MSG_ERROR([DRI and Xlib-GLX cannot be built together])
716 fi
717
718 if test "x$enable_opengl$enable_xlib_glx" = xnoyes; then
719 AC_MSG_ERROR([Xlib-GLX cannot be built without OpenGL])
720 fi
721
722 # Disable GLX if OpenGL is not enabled
723 if test "x$enable_glx$enable_opengl" = xyesno; then
724 AC_MSG_WARN([OpenGL not enabled, disabling GLX])
725 enable_glx=no
726 fi
727
728 # Disable GLX if DRI and Xlib-GLX are not enabled
729 if test "x$enable_glx" = xyes -a \
730 "x$enable_dri" = xno -a \
731 "x$enable_xlib_glx" = xno; then
732 AC_MSG_WARN([Neither DRI nor Xlib-GLX enabled, disabling GLX])
733 enable_glx=no
734 fi
735
736 AM_CONDITIONAL(HAVE_DRI_GLX, test "x$enable_glx" = xyes -a \
737 "x$enable_dri" = xyes)
738 AM_CONDITIONAL(HAVE_DRI, test "x$enable_dri" = xyes)
739 AM_CONDITIONAL(NEED_LIBMESA, test "x$enable_xlib_glx" = xyes -o \
740 "x$enable_osmesa" = xyes)
741
742 AC_ARG_ENABLE([shared-glapi],
743 [AS_HELP_STRING([--enable-shared-glapi],
744 [Enable shared glapi for OpenGL @<:@default=yes@:>@])],
745 [enable_shared_glapi="$enableval"],
746 [enable_shared_glapi="$enable_dri"])
747
748 # Shared GLAPI is only useful for DRI
749 if test "x$enable_dri" = xno; then
750 AC_MSG_NOTICE([Shared GLAPI is only useful for DRI, disabling])
751 enable_shared_glapi=no
752 fi
753
754 AM_CONDITIONAL(HAVE_SHARED_GLAPI, test "x$enable_shared_glapi" = xyes)
755
756 dnl
757 dnl Driver specific build directories
758 dnl
759 GALLIUM_TARGET_DIRS=""
760 GALLIUM_WINSYS_DIRS="sw"
761 GALLIUM_DRIVERS_DIRS="galahad trace rbug noop identity"
762 GALLIUM_STATE_TRACKERS_DIRS=""
763
764 case "x$enable_glx$enable_xlib_glx" in
765 xyesyes)
766 GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS sw/xlib"
767 GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS libgl-xlib"
768 GALLIUM_STATE_TRACKERS_DIRS="glx $GALLIUM_STATE_TRACKERS_DIRS"
769 NEED_WINSYS_XLIB="yes"
770 ;;
771 esac
772
773 if test "x$enable_dri" = xyes; then
774 GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS sw/dri"
775 GALLIUM_STATE_TRACKERS_DIRS="dri $GALLIUM_STATE_TRACKERS_DIRS"
776 fi
777
778 if test "x$enable_gallium_osmesa" = xyes; then
779 if test -z "$with_gallium_drivers"; then
780 AC_MSG_ERROR([Cannot enable gallium_osmesa without Gallium])
781 fi
782 if test "x$enable_osmesa" = xyes; then
783 AC_MSG_ERROR([Cannot enable both classic and Gallium OSMesa implementations])
784 fi
785 GALLIUM_STATE_TRACKERS_DIRS="osmesa $GALLIUM_STATE_TRACKERS_DIRS"
786 GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS osmesa"
787 fi
788
789 AC_SUBST([MESA_LLVM])
790
791 # Check for libdrm
792 PKG_CHECK_MODULES([LIBDRM], [libdrm >= $LIBDRM_REQUIRED],
793 [have_libdrm=yes], [have_libdrm=no])
794
795 if test "x$enable_dri" = xyes; then
796 # DRI must be shared, I think
797 if test "$enable_static" = yes; then
798 AC_MSG_ERROR([Cannot use static libraries for DRI drivers])
799 fi
800
801 # not a hard requirement as swrast does not depend on it
802 if test "x$have_libdrm" = xyes; then
803 DRI_PC_REQ_PRIV="libdrm >= $LIBDRM_REQUIRED"
804 fi
805 fi
806
807 dnl Direct rendering or just indirect rendering
808 case "$host_os" in
809 gnu*)
810 dnl Disable by default on GNU/Hurd
811 driglx_direct_default="no"
812 ;;
813 cygwin*)
814 dnl Disable by default on cygwin
815 driglx_direct_default="no"
816 ;;
817 *)
818 driglx_direct_default="yes"
819 ;;
820 esac
821 AC_ARG_ENABLE([driglx-direct],
822 [AS_HELP_STRING([--disable-driglx-direct],
823 [disable direct rendering in GLX and EGL for DRI \
824 @<:@default=auto@:>@])],
825 [driglx_direct="$enableval"],
826 [driglx_direct="$driglx_direct_default"])
827
828 dnl
829 dnl libGL configuration per driver
830 dnl
831 case "x$enable_glx$enable_xlib_glx" in
832 xyesyes)
833 # Xlib-based GLX
834 PKG_CHECK_MODULES([XLIBGL], [x11 xext])
835 GL_PC_REQ_PRIV="x11 xext"
836 X11_INCLUDES="$X11_INCLUDES $XLIBGL_CFLAGS"
837 GL_LIB_DEPS="$XLIBGL_LIBS"
838 GL_LIB_DEPS="$GL_LIB_DEPS $SELINUX_LIBS -lm $PTHREAD_LIBS $DLOPEN_LIBS"
839 GL_PC_LIB_PRIV="$GL_PC_LIB_PRIV $SELINUX_LIBS -lm $PTHREAD_LIBS"
840 ;;
841 xyesno)
842 # DRI-based GLX
843 PKG_CHECK_MODULES([GLPROTO], [glproto >= $GLPROTO_REQUIRED])
844 if test x"$driglx_direct" = xyes; then
845 if test "x$have_libdrm" != xyes; then
846 AC_MSG_ERROR([Direct rendering requires libdrm >= $LIBDRM_REQUIRED])
847 fi
848 PKG_CHECK_MODULES([DRI2PROTO], [dri2proto >= $DRI2PROTO_REQUIRED])
849 GL_PC_REQ_PRIV="$GL_PC_REQ_PRIV libdrm >= $LIBDRM_REQUIRED"
850 fi
851
852 # find the DRI deps for libGL
853 dri_modules="x11 xext xdamage xfixes x11-xcb xcb-glx >= 1.8.1 xcb-dri2 >= 1.8"
854
855 # add xf86vidmode if available
856 PKG_CHECK_MODULES([XF86VIDMODE], [xxf86vm], HAVE_XF86VIDMODE=yes, HAVE_XF86VIDMODE=no)
857 if test "$HAVE_XF86VIDMODE" = yes ; then
858 dri_modules="$dri_modules xxf86vm"
859 fi
860
861 PKG_CHECK_MODULES([DRIGL], [$dri_modules])
862 GL_PC_REQ_PRIV="$GL_PC_REQ_PRIV $dri_modules"
863 X11_INCLUDES="$X11_INCLUDES $DRIGL_CFLAGS"
864 GL_LIB_DEPS="$DRIGL_LIBS"
865
866 # need DRM libs, $PTHREAD_LIBS, etc.
867 GL_LIB_DEPS="$GL_LIB_DEPS $LIBDRM_LIBS -lm $PTHREAD_LIBS $DLOPEN_LIBS"
868 GL_PC_LIB_PRIV="-lm $PTHREAD_LIBS $DLOPEN_LIBS"
869 ;;
870 esac
871
872 # This is outside the case (above) so that it is invoked even for non-GLX
873 # builds.
874 AM_CONDITIONAL(HAVE_XF86VIDMODE, test "x$HAVE_XF86VIDMODE" = xyes)
875
876 GLESv1_CM_LIB_DEPS="$LIBDRM_LIBS -lm $PTHREAD_LIBS $DLOPEN_LIBS"
877 GLESv1_CM_PC_LIB_PRIV="-lm $PTHREAD_LIBS $DLOPEN_LIBS"
878 GLESv2_LIB_DEPS="$LIBDRM_LIBS -lm $PTHREAD_LIBS $DLOPEN_LIBS"
879 GLESv2_PC_LIB_PRIV="-lm $PTHREAD_LIBS $DLOPEN_LIBS"
880
881 AC_SUBST([X11_INCLUDES])
882 AC_SUBST([GL_LIB_DEPS])
883 AC_SUBST([GL_PC_REQ_PRIV])
884 AC_SUBST([GL_PC_LIB_PRIV])
885 AC_SUBST([GL_PC_CFLAGS])
886 AC_SUBST([DRI_PC_REQ_PRIV])
887 AC_SUBST([GLESv1_CM_LIB_DEPS])
888 AC_SUBST([GLESv1_CM_PC_LIB_PRIV])
889 AC_SUBST([GLESv2_LIB_DEPS])
890 AC_SUBST([GLESv2_PC_LIB_PRIV])
891
892 DRI_LIB_DEPS="\$(top_builddir)/src/mesa/libdricore/libdricore${VERSION}.la"
893
894 AC_SUBST([HAVE_XF86VIDMODE])
895
896 dnl
897 dnl More GLX setup
898 dnl
899 case "x$enable_glx$enable_xlib_glx" in
900 xyesyes)
901 DEFINES="$DEFINES -DUSE_XSHM"
902 ;;
903 xyesno)
904 DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING"
905 if test "x$driglx_direct" = xyes; then
906 DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
907 fi
908 ;;
909 esac
910
911 dnl
912 dnl TLS detection
913 dnl
914
915 AC_ARG_ENABLE([glx-tls],
916 [AS_HELP_STRING([--enable-glx-tls],
917 [enable TLS support in GLX @<:@default=disabled@:>@])],
918 [GLX_USE_TLS="$enableval"],
919 [GLX_USE_TLS=no])
920 AC_SUBST(GLX_TLS, ${GLX_USE_TLS})
921
922 AS_IF([test "x$GLX_USE_TLS" = xyes -a "x$ax_pthread_ok" = xyes],
923 [DEFINES="${DEFINES} -DGLX_USE_TLS -DHAVE_PTHREAD"])
924
925 dnl
926 dnl More DRI setup
927 dnl
928 dnl Directory for DRI drivers
929 AC_ARG_WITH([dri-driverdir],
930 [AS_HELP_STRING([--with-dri-driverdir=DIR],
931 [directory for the DRI drivers @<:@${libdir}/dri@:>@])],
932 [DRI_DRIVER_INSTALL_DIR="$withval"],
933 [DRI_DRIVER_INSTALL_DIR='${libdir}/dri'])
934 AC_SUBST([DRI_DRIVER_INSTALL_DIR])
935 dnl Extra search path for DRI drivers
936 AC_ARG_WITH([dri-searchpath],
937 [AS_HELP_STRING([--with-dri-searchpath=DIRS...],
938 [semicolon delimited DRI driver search directories @<:@${libdir}/dri@:>@])],
939 [DRI_DRIVER_SEARCH_DIR="$withval"],
940 [DRI_DRIVER_SEARCH_DIR='${DRI_DRIVER_INSTALL_DIR}'])
941 AC_SUBST([DRI_DRIVER_SEARCH_DIR])
942 dnl Which drivers to build - default is chosen by platform
943 AC_ARG_WITH([dri-drivers],
944 [AS_HELP_STRING([--with-dri-drivers@<:@=DIRS...@:>@],
945 [comma delimited DRI drivers list, e.g.
946 "swrast,i965,radeon" @<:@default=auto@:>@])],
947 [with_dri_drivers="$withval"],
948 [with_dri_drivers=yes])
949 if test "x$with_dri_drivers" = x; then
950 with_dri_drivers=no
951 fi
952
953 dnl If $with_dri_drivers is yes, directories will be added through
954 dnl platform checks
955 DRI_DIRS=""
956 case "$with_dri_drivers" in
957 no) ;;
958 yes)
959 # classic DRI drivers
960 if test "x$enable_opengl" = xyes; then
961 DRI_DIRS="yes"
962 fi
963 ;;
964 *)
965 # verify the requested driver directories exist
966 dri_drivers=`IFS=', '; echo $with_dri_drivers`
967 for driver in $dri_drivers; do
968 test -d "$srcdir/src/mesa/drivers/dri/$driver" || \
969 AC_MSG_ERROR([DRI driver directory '$driver' does not exist])
970 done
971 DRI_DIRS="$dri_drivers"
972 if test -n "$DRI_DIRS" -a "x$enable_opengl" != xyes; then
973 AC_MSG_ERROR([--with-dri-drivers requires OpenGL])
974 fi
975 ;;
976 esac
977
978 dnl Set DRI_DIRS, DEFINES and LIB_DEPS
979 if test "x$enable_dri" = xyes; then
980 # Platform specific settings and drivers to build
981 case "$host_os" in
982 linux*)
983 DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1"
984 DEFINES="$DEFINES -DHAVE_ALIAS"
985
986 case "$host_cpu" in
987 x86_64|amd64)
988 if test "x$DRI_DIRS" = "xyes"; then
989 DRI_DIRS="i915 i965 nouveau r200 radeon swrast"
990 fi
991 ;;
992 powerpc*)
993 # Build only the drivers for cards that exist on PowerPC.
994 if test "x$DRI_DIRS" = "xyes"; then
995 DRI_DIRS="r200 radeon swrast"
996 fi
997 ;;
998 sparc*)
999 # Build only the drivers for cards that exist on sparc
1000 if test "x$DRI_DIRS" = "xyes"; then
1001 DRI_DIRS="r200 radeon swrast"
1002 fi
1003 ;;
1004 esac
1005 ;;
1006 freebsd* | dragonfly* | *netbsd* | openbsd*)
1007 DEFINES="$DEFINES -DHAVE_PTHREAD -DUSE_EXTERNAL_DXTN_LIB=1"
1008 DEFINES="$DEFINES -DHAVE_ALIAS"
1009
1010 if test "x$DRI_DIRS" = "xyes"; then
1011 DRI_DIRS="i915 i965 nouveau r200 radeon swrast"
1012 fi
1013 ;;
1014 gnu*)
1015 DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1"
1016 DEFINES="$DEFINES -DHAVE_ALIAS"
1017 ;;
1018 solaris*)
1019 DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1"
1020 ;;
1021 cygwin*)
1022 DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1"
1023 if test "x$DRI_DIRS" = "xyes"; then
1024 DRI_DIRS="swrast"
1025 fi
1026 ;;
1027 esac
1028
1029 # default drivers
1030 if test "x$DRI_DIRS" = "xyes"; then
1031 DRI_DIRS="i915 i965 nouveau r200 radeon swrast"
1032 fi
1033
1034 DRI_DIRS=`echo "$DRI_DIRS" | $SED 's/ */ /g'`
1035
1036 # Check for expat
1037 EXPAT_INCLUDES=""
1038 EXPAT_LIB=-lexpat
1039 AC_ARG_WITH([expat],
1040 [AS_HELP_STRING([--with-expat=DIR],
1041 [expat install directory])],[
1042 EXPAT_INCLUDES="-I$withval/include"
1043 CPPFLAGS="$CPPFLAGS $EXPAT_INCLUDES"
1044 LDFLAGS="$LDFLAGS -L$withval/$LIB_DIR"
1045 EXPAT_LIB="-L$withval/$LIB_DIR -lexpat"
1046 ])
1047 AC_CHECK_HEADER([expat.h],[],[AC_MSG_ERROR([Expat required for DRI.])])
1048 save_LIBS="$LIBS"
1049 AC_CHECK_LIB([expat],[XML_ParserCreate],[],
1050 [AC_MSG_ERROR([Expat required for DRI.])])
1051 LIBS="$save_LIBS"
1052
1053 # If we are building any DRI driver other than swrast.
1054 if test -n "$DRI_DIRS" -a x"$DRI_DIRS" != xswrast; then
1055 # ... libdrm is required
1056 if test "x$have_libdrm" != xyes; then
1057 AC_MSG_ERROR([DRI drivers requires libdrm >= $LIBDRM_REQUIRED])
1058 fi
1059 # ... and build dricommon
1060 HAVE_COMMON_DRI=yes
1061 fi
1062
1063 # put all the necessary libs together
1064 DRI_LIB_DEPS="$DRI_LIB_DEPS $SELINUX_LIBS $LIBDRM_LIBS $EXPAT_LIB -lm $PTHREAD_LIBS $DLOPEN_LIBS"
1065 GALLIUM_DRI_LIB_DEPS="$GALLIUM_DRI_LIB_DEPS $SELINUX_LIBS $LIBDRM_LIBS $EXPAT_LIB -lm $CLOCK_LIB $PTHREAD_LIBS $DLOPEN_LIBS"
1066 fi
1067 AM_CONDITIONAL(NEED_LIBDRICORE, test -n "$DRI_DIRS")
1068 AC_SUBST([EXPAT_INCLUDES])
1069 AC_SUBST([DRI_LIB_DEPS])
1070 AC_SUBST([GALLIUM_DRI_LIB_DEPS])
1071
1072 case $DRI_DIRS in
1073 *i915*|*i965*)
1074 PKG_CHECK_MODULES([INTEL], [libdrm_intel >= $LIBDRM_INTEL_REQUIRED])
1075
1076 for d in $(echo $DRI_DIRS | sed 's/,/ /g'); do
1077 case $d in
1078 i915)
1079 HAVE_I915_DRI=yes;
1080 ;;
1081 i965)
1082 HAVE_I965_DRI=yes;
1083 ;;
1084 esac
1085 done
1086
1087 ;;
1088 esac
1089
1090 case $DRI_DIRS in
1091 *nouveau*)
1092 PKG_CHECK_MODULES([NOUVEAU], [libdrm_nouveau >= $LIBDRM_NVVIEUX_REQUIRED])
1093 HAVE_NOUVEAU_DRI=yes;
1094 ;;
1095 esac
1096
1097 case $DRI_DIRS in
1098 *radeon*|*r200*)
1099 PKG_CHECK_MODULES([RADEON], [libdrm_radeon >= $LIBDRM_RADEON_REQUIRED])
1100
1101 for d in $(echo $DRI_DIRS | sed 's/,/ /g'); do
1102 case $d in
1103 radeon)
1104 HAVE_RADEON_DRI=yes;
1105 ;;
1106 r200)
1107 HAVE_R200_DRI=yes;
1108 ;;
1109 esac
1110 done
1111
1112 ;;
1113 esac
1114
1115 case $DRI_DIRS in
1116 *swrast*)
1117 HAVE_SWRAST_DRI=yes;
1118 ;;
1119 esac
1120
1121 dnl
1122 dnl OSMesa configuration
1123 dnl
1124
1125 dnl Configure the channel bits for OSMesa (libOSMesa, libOSMesa16, ...)
1126 AC_ARG_WITH([osmesa-bits],
1127 [AS_HELP_STRING([--with-osmesa-bits=BITS],
1128 [OSMesa channel bits and library name: 8, 16, 32 @<:@default=8@:>@])],
1129 [osmesa_bits="$withval"],
1130 [osmesa_bits=8])
1131 if test "x$osmesa_bits" != x8; then
1132 if test "x$enable_dri" = xyes -o "x$enable_glx" = xyes; then
1133 AC_MSG_WARN([Ignoring OSMesa channel bits because of non-OSMesa driver])
1134 osmesa_bits=8
1135 fi
1136 fi
1137 case "x$osmesa_bits" in
1138 x8)
1139 OSMESA_LIB="${OSMESA_LIB}"
1140 ;;
1141 x16|x32)
1142 OSMESA_LIB="${OSMESA_LIB}$osmesa_bits"
1143 DEFINES="$DEFINES -DCHAN_BITS=$osmesa_bits -DDEFAULT_SOFTWARE_DEPTH_BITS=31"
1144 ;;
1145 *)
1146 AC_MSG_ERROR([OSMesa bits '$osmesa_bits' is not a valid option])
1147 ;;
1148 esac
1149
1150 if test "x$enable_osmesa" = xyes -o "x$enable_gallium_osmesa" = xyes; then
1151 # only link libraries with osmesa if shared
1152 if test "$enable_static" = no; then
1153 OSMESA_LIB_DEPS="-lm $PTHREAD_LIBS $SELINUX_LIBS $DLOPEN_LIBS"
1154 else
1155 OSMESA_LIB_DEPS=""
1156 fi
1157 OSMESA_MESA_DEPS=""
1158 OSMESA_PC_LIB_PRIV="-lm $PTHREAD_LIBS $SELINUX_LIBS $DLOPEN_LIBS"
1159 fi
1160
1161 AC_SUBST([OSMESA_LIB_DEPS])
1162 AC_SUBST([OSMESA_MESA_DEPS])
1163 AC_SUBST([OSMESA_PC_REQ])
1164 AC_SUBST([OSMESA_PC_LIB_PRIV])
1165
1166 dnl
1167 dnl gbm configuration
1168 dnl
1169 if test "x$enable_gbm" = xauto; then
1170 case "$with_egl_platforms" in
1171 *drm*)
1172 enable_gbm=yes ;;
1173 *)
1174 enable_gbm=no ;;
1175 esac
1176 fi
1177 if test "x$enable_gbm" = xyes; then
1178 PKG_CHECK_MODULES([LIBUDEV], [libudev], [],
1179 AC_MSG_ERROR([gbm needs udev]))
1180
1181 if test "x$enable_dri" = xyes; then
1182 GBM_BACKEND_DIRS="$GBM_BACKEND_DIRS dri"
1183 if test "x$enable_shared_glapi" = xno; then
1184 AC_MSG_ERROR([gbm_dri requires --enable-shared-glapi])
1185 fi
1186 fi
1187 fi
1188 AM_CONDITIONAL(HAVE_GBM, test "x$enable_gbm" = xyes)
1189 GBM_PC_REQ_PRIV="libudev"
1190 GBM_PC_LIB_PRIV="$DLOPEN_LIBS"
1191 AC_SUBST([GBM_PC_REQ_PRIV])
1192 AC_SUBST([GBM_PC_LIB_PRIV])
1193
1194 dnl
1195 dnl EGL configuration
1196 dnl
1197 EGL_CLIENT_APIS=""
1198
1199 if test "x$enable_egl" = xyes; then
1200 EGL_LIB_DEPS="$DLOPEN_LIBS $SELINUX_LIBS $PTHREAD_LIBS"
1201
1202 AC_CHECK_FUNC(mincore, [DEFINES="$DEFINES -DHAVE_MINCORE"])
1203
1204 if test "$enable_static" != yes; then
1205 # build egl_glx when libGL is built
1206 PKG_CHECK_MODULES([LIBUDEV], [libudev > 150],
1207 [have_libudev=yes],[have_libudev=no])
1208 if test "$have_libudev" = yes; then
1209 DEFINES="$DEFINES -DHAVE_LIBUDEV"
1210 fi
1211
1212 if test "x$enable_dri" = xyes; then
1213 HAVE_EGL_DRIVER_DRI2=1
1214 fi
1215
1216 fi
1217 fi
1218 AM_CONDITIONAL(HAVE_EGL, test "x$enable_egl" = xyes)
1219 AC_SUBST([EGL_LIB_DEPS])
1220
1221 dnl
1222 dnl EGL Gallium configuration
1223 dnl
1224 if test "x$enable_gallium_egl" = xyes; then
1225 if test "x$with_gallium_drivers" = x; then
1226 AC_MSG_ERROR([cannot enable egl_gallium without Gallium])
1227 fi
1228 if test "x$enable_egl" = xno; then
1229 AC_MSG_ERROR([cannot enable egl_gallium without EGL])
1230 fi
1231 if test "x$have_libdrm" != xyes; then
1232 AC_MSG_ERROR([egl_gallium requires libdrm >= $LIBDRM_REQUIRED])
1233 fi
1234
1235 GALLIUM_STATE_TRACKERS_DIRS="egl $GALLIUM_STATE_TRACKERS_DIRS"
1236 GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS egl-static"
1237 fi
1238 AM_CONDITIONAL(HAVE_GALLIUM_EGL, test "x$enable_gallium_egl" = xyes)
1239
1240 dnl
1241 dnl gbm Gallium configuration
1242 dnl
1243 if test "x$enable_gallium_gbm" = xauto; then
1244 case "$enable_gbm$enable_gallium_egl$enable_dri$with_egl_platforms" in
1245 yesyesyes*drm*)
1246 enable_gallium_gbm=yes ;;
1247 *)
1248 enable_gallium_gbm=no ;;
1249 esac
1250 fi
1251 if test "x$enable_gallium_gbm" = xyes; then
1252 if test "x$with_gallium_drivers" = x; then
1253 AC_MSG_ERROR([cannot enable gbm_gallium without Gallium])
1254 fi
1255 if test "x$enable_gbm" = xno; then
1256 AC_MSG_ERROR([cannot enable gbm_gallium without gbm])
1257 fi
1258 # gbm_gallium abuses DRI_LIB_DEPS to link. Make sure it is set.
1259 if test "x$enable_dri" = xno; then
1260 AC_MSG_ERROR([gbm_gallium requires --enable-dri to build])
1261 fi
1262
1263 GALLIUM_STATE_TRACKERS_DIRS="gbm $GALLIUM_STATE_TRACKERS_DIRS"
1264 GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS gbm"
1265 enable_gallium_loader=yes
1266 fi
1267 AM_CONDITIONAL(HAVE_GALLIUM_GBM, test "x$enable_gallium_gbm" = xyes)
1268
1269 dnl
1270 dnl X.Org DDX configuration
1271 dnl
1272 if test "x$enable_xorg" = xyes; then
1273 PKG_CHECK_MODULES([XORG], [xorg-server >= 1.6.0])
1274 PKG_CHECK_MODULES([LIBDRM_XORG], [libdrm >= $LIBDRM_XORG_REQUIRED])
1275 PKG_CHECK_MODULES([LIBKMS_XORG], [libkms >= $LIBKMS_XORG_REQUIRED])
1276 PKG_CHECK_MODULES(XEXT, [xextproto >= 7.0.99.1],
1277 HAVE_XEXTPROTO_71="yes"; DEFINES="$DEFINES -DHAVE_XEXTPROTO_71",
1278 HAVE_XEXTPROTO_71="no")
1279 GALLIUM_STATE_TRACKERS_DIRS="xorg $GALLIUM_STATE_TRACKERS_DIRS"
1280 fi
1281 AM_CONDITIONAL(HAVE_ST_XORG, test "x$enable_xorg" = xyes)
1282
1283 dnl
1284 dnl XA configuration
1285 dnl
1286 if test "x$enable_xa" = xyes; then
1287 AC_PROG_AWK
1288 AC_PROG_GREP
1289 AC_CHECK_PROG(NM, nm, "nm")
1290 if test "x$AWK" = x || test "x$GREP" = x || test "x$NM" = x; then
1291 AC_MSG_WARN([Missing one of nm, grep or awk. Disabling xa.])
1292 enable_xa=no
1293 fi
1294 fi
1295 if test "x$enable_xa" = xyes; then
1296 GALLIUM_STATE_TRACKERS_DIRS="xa $GALLIUM_STATE_TRACKERS_DIRS"
1297 AC_SUBST(AWK)
1298 AC_SUBST(GREP)
1299 AC_SUBST(NM)
1300 fi
1301 AM_CONDITIONAL(HAVE_ST_XA, test "x$enable_xa" = xyes)
1302
1303 dnl
1304 dnl OpenVG configuration
1305 dnl
1306 VG_LIB_DEPS=""
1307
1308 if test "x$enable_openvg" = xyes; then
1309 if test "x$enable_egl" = xno; then
1310 AC_MSG_ERROR([cannot enable OpenVG without EGL])
1311 fi
1312 if test "x$with_gallium_drivers" = x; then
1313 AC_MSG_ERROR([cannot enable OpenVG without Gallium])
1314 fi
1315 if test "x$enable_gallium_egl" = xno; then
1316 AC_MSG_ERROR([cannot enable OpenVG without egl_gallium])
1317 fi
1318
1319 EGL_CLIENT_APIS="$EGL_CLIENT_APIS "'$(VG_LIB)'
1320 VG_LIB_DEPS="$VG_LIB_DEPS $SELINUX_LIBS $PTHREAD_LIBS"
1321 GALLIUM_STATE_TRACKERS_DIRS="vega $GALLIUM_STATE_TRACKERS_DIRS"
1322 VG_PC_LIB_PRIV="-lm $CLOCK_LIB $PTHREAD_LIBS $DLOPEN_LIBS"
1323 AC_SUBST([VG_PC_LIB_PRIV])
1324 fi
1325 AM_CONDITIONAL(HAVE_OPENVG, test "x$enable_openvg" = xyes)
1326
1327 dnl
1328 dnl Gallium G3DVL configuration
1329 dnl
1330 if test -n "$with_gallium_drivers"; then
1331 if test "x$enable_xvmc" = xauto; then
1332 PKG_CHECK_EXISTS([xvmc], [enable_xvmc=yes], [enable_xvmc=no])
1333 fi
1334
1335 if test "x$enable_vdpau" = xauto; then
1336 PKG_CHECK_EXISTS([vdpau], [enable_vdpau=yes], [enable_vdpau=no])
1337 fi
1338 fi
1339
1340 if test "x$enable_xvmc" = xyes; then
1341 PKG_CHECK_MODULES([XVMC], [xvmc >= 1.0.6 x11-xcb xcb-dri2 >= 1.8])
1342 GALLIUM_STATE_TRACKERS_DIRS="$GALLIUM_STATE_TRACKERS_DIRS xvmc"
1343 fi
1344 AM_CONDITIONAL(HAVE_ST_XVMC, test "x$enable_xvmc" = xyes)
1345
1346 if test "x$enable_vdpau" = xyes; then
1347 PKG_CHECK_MODULES([VDPAU], [vdpau >= 0.4.1 x11-xcb xcb-dri2 >= 1.8])
1348 GALLIUM_STATE_TRACKERS_DIRS="$GALLIUM_STATE_TRACKERS_DIRS vdpau"
1349 fi
1350 AM_CONDITIONAL(HAVE_ST_VDPAU, test "x$enable_vdpau" = xyes)
1351
1352 dnl
1353 dnl OpenCL configuration
1354 dnl
1355
1356 AC_ARG_WITH([libclc-path],
1357 [AS_HELP_STRING([--with-libclc-path],
1358 [DEPRECATED: See http://dri.freedesktop.org/wiki/GalliumCompute#How_to_Install])],
1359 [LIBCLC_PATH="$withval"],
1360 [LIBCLC_PATH=""])
1361
1362 if test "x$LIBCLC_PATH" != x; then
1363 AC_MSG_ERROR([The --with-libclc-path option has been deprecated.
1364 Please review the updated build instructions for clover:
1365 http://dri.freedesktop.org/wiki/GalliumCompute])
1366 fi
1367
1368
1369 AC_ARG_WITH([clang-libdir],
1370 [AS_HELP_STRING([--with-clang-libdir],
1371 [Path to Clang libraries @<:@default=llvm-config --libdir@:>@])],
1372 [CLANG_LIBDIR="$withval"],
1373 [CLANG_LIBDIR=""])
1374
1375 LIBCLC_INCLUDEDIR=`pkg-config --variable=includedir libclc`
1376 LIBCLC_LIBEXECDIR=`pkg-config --variable=libexecdir libclc`
1377 AC_SUBST([LIBCLC_INCLUDEDIR])
1378 AC_SUBST([LIBCLC_LIBEXECDIR])
1379
1380 if test "x$enable_opencl" = xyes; then
1381 if test "x$with_gallium_drivers" = x; then
1382 AC_MSG_ERROR([cannot enable OpenCL without Gallium])
1383 fi
1384
1385 if test $GCC_VERSION_MAJOR -lt 4 -o $GCC_VERSION_MAJOR -eq 4 -a $GCC_VERSION_MINOR -lt 6; then
1386 AC_MSG_ERROR([gcc >= 4.6 is required to build clover])
1387 fi
1388
1389 if test "x$LIBCLC_INCLUDEDIR" == x || test "x$LIBCLC_LIBEXECDIR" == x; then
1390 AC_MSG_ERROR([pkg-config cannot use libclc.pc which is required to build clover])
1391 fi
1392
1393 GALLIUM_STATE_TRACKERS_DIRS="$GALLIUM_STATE_TRACKERS_DIRS clover"
1394 GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS opencl"
1395 enable_gallium_loader=yes
1396 fi
1397 AM_CONDITIONAL(HAVE_CLOVER, test "x$enable_opencl" = xyes)
1398
1399 dnl
1400 dnl Gallium configuration
1401 dnl
1402 AM_CONDITIONAL(HAVE_GALLIUM, test -n "$with_gallium_drivers")
1403
1404 AC_SUBST([LLVM_BINDIR])
1405 AC_SUBST([LLVM_CFLAGS])
1406 AC_SUBST([LLVM_CPPFLAGS])
1407 AC_SUBST([LLVM_CXXFLAGS])
1408 AC_SUBST([LLVM_LIBDIR])
1409 AC_SUBST([LLVM_LIBS])
1410 AC_SUBST([LLVM_LDFLAGS])
1411 AC_SUBST([LLVM_INCLUDEDIR])
1412 AC_SUBST([LLVM_VERSION])
1413 AC_SUBST([CLANG_RESOURCE_DIR])
1414
1415 case "x$enable_opengl$enable_gles1$enable_gles2" in
1416 x*yes*)
1417 EGL_CLIENT_APIS="$EGL_CLIENT_APIS "'$(GL_LIB)'
1418 ;;
1419 esac
1420
1421 AC_SUBST([VG_LIB_DEPS])
1422 AC_SUBST([EGL_CLIENT_APIS])
1423
1424 dnl
1425 dnl EGL Platforms configuration
1426 dnl
1427 AC_ARG_WITH([egl-platforms],
1428 [AS_HELP_STRING([--with-egl-platforms@<:@=DIRS...@:>@],
1429 [comma delimited native platforms libEGL supports, e.g.
1430 "x11,drm" @<:@default=auto@:>@])],
1431 [with_egl_platforms="$withval"],
1432 [if test "x$enable_egl" = xyes; then
1433 with_egl_platforms="x11"
1434 else
1435 with_egl_platforms=""
1436 fi])
1437
1438 if test "x$with_egl_platforms" != "x" -a "x$enable_egl" != xyes; then
1439 AC_MSG_ERROR([cannot build egl state tracker without EGL library])
1440 fi
1441
1442 # Do per-EGL platform setups and checks
1443 egl_platforms=`IFS=', '; echo $with_egl_platforms`
1444 for plat in $egl_platforms; do
1445 case "$plat" in
1446 wayland)
1447 PKG_CHECK_MODULES([WAYLAND], [wayland-client >= 1.2.0 wayland-server >= 1.2.0])
1448 GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS sw/wayland"
1449
1450 WAYLAND_PREFIX=`$PKG_CONFIG --variable=prefix wayland-client`
1451 AC_PATH_PROG([WAYLAND_SCANNER], [wayland-scanner],,
1452 [${WAYLAND_PREFIX}/bin$PATH_SEPARATOR$PATH])
1453 ;;
1454
1455 x11)
1456 PKG_CHECK_MODULES([XCB_DRI2], [x11-xcb xcb-dri2 >= 1.8 xcb-xfixes])
1457
1458 if test "x$enable_glx" = xyes; then
1459 HAVE_EGL_DRIVER_GLX=1
1460 fi
1461 ;;
1462
1463 drm)
1464 test "x$enable_gbm" = "xno" &&
1465 AC_MSG_ERROR([EGL platform drm needs gbm])
1466 ;;
1467
1468 android|fbdev|gdi|null)
1469 ;;
1470
1471 *)
1472 AC_MSG_ERROR([EGL platform '$plat' does not exist])
1473 ;;
1474 esac
1475
1476 case "$plat$have_libudev" in
1477 waylandno|drmno)
1478 AC_MSG_ERROR([cannot build $plat platfrom without udev]) ;;
1479 esac
1480 done
1481
1482 # libEGL wants to default to the first platform specified in
1483 # ./configure. parse that here.
1484 if test "x$egl_platforms" != "x"; then
1485 FIRST_PLATFORM_CAPS=`echo $egl_platforms | sed 's| .*||' | tr 'a-z' 'A-Z'`
1486 EGL_NATIVE_PLATFORM="_EGL_PLATFORM_$FIRST_PLATFORM_CAPS"
1487 else
1488 EGL_NATIVE_PLATFORM="_EGL_INVALID_PLATFORM"
1489 fi
1490
1491 if echo "$egl_platforms" | grep 'x11' >/dev/null 2>&1; then
1492 NEED_WINSYS_XLIB=yes
1493 fi
1494 AM_CONDITIONAL(HAVE_EGL_PLATFORM_X11, echo "$egl_platforms" | grep 'x11' >/dev/null 2>&1)
1495 AM_CONDITIONAL(HAVE_EGL_PLATFORM_WAYLAND, echo "$egl_platforms" | grep 'wayland' >/dev/null 2>&1)
1496 AM_CONDITIONAL(HAVE_EGL_PLATFORM_DRM, echo "$egl_platforms" | grep 'drm' >/dev/null 2>&1)
1497 AM_CONDITIONAL(HAVE_EGL_PLATFORM_FBDEV, echo "$egl_platforms" | grep 'fbdev' >/dev/null 2>&1)
1498 AM_CONDITIONAL(HAVE_EGL_PLATFORM_NULL, echo "$egl_platforms" | grep 'null' >/dev/null 2>&1)
1499
1500 AM_CONDITIONAL(HAVE_EGL_DRIVER_DRI2, test "x$HAVE_EGL_DRIVER_DRI2" != "x")
1501 AM_CONDITIONAL(HAVE_EGL_DRIVER_GLX, test "x$HAVE_EGL_DRIVER_GLX" != "x")
1502
1503 AC_SUBST([EGL_NATIVE_PLATFORM])
1504 AC_SUBST([EGL_CFLAGS])
1505
1506 # If we don't have the X11 platform, set this define so we don't try to include
1507 # the X11 headers.
1508 if ! echo "$egl_platforms" | grep -q 'x11'; then
1509 DEFINES="$DEFINES -DMESA_EGL_NO_X11_HEADERS"
1510 GL_PC_CFLAGS="$GL_PC_CFLAGS -DMESA_EGL_NO_X11_HEADERS"
1511 fi
1512
1513 AC_ARG_WITH([egl-driver-dir],
1514 [AS_HELP_STRING([--with-egl-driver-dir=DIR],
1515 [directory for EGL drivers [[default=${libdir}/egl]]])],
1516 [EGL_DRIVER_INSTALL_DIR="$withval"],
1517 [EGL_DRIVER_INSTALL_DIR='${libdir}/egl'])
1518 AC_SUBST([EGL_DRIVER_INSTALL_DIR])
1519
1520 AC_ARG_WITH([xorg-driver-dir],
1521 [AS_HELP_STRING([--with-xorg-driver-dir=DIR],
1522 [Default xorg driver directory[[default=${libdir}/xorg/modules/drivers]]])],
1523 [XORG_DRIVER_INSTALL_DIR="$withval"],
1524 [XORG_DRIVER_INSTALL_DIR="${libdir}/xorg/modules/drivers"])
1525 AC_SUBST([XORG_DRIVER_INSTALL_DIR])
1526
1527 AC_ARG_WITH([max-width],
1528 [AS_HELP_STRING([--with-max-width=N],
1529 [Maximum framebuffer width (4096)])],
1530 [DEFINES="${DEFINES} -DMAX_WIDTH=${withval}";
1531 AS_IF([test "${withval}" -gt "4096"],
1532 [AC_MSG_WARN([Large framebuffer: see s_tritemp.h comments.])])]
1533 )
1534 AC_ARG_WITH([max-height],
1535 [AS_HELP_STRING([--with-max-height=N],
1536 [Maximum framebuffer height (4096)])],
1537 [DEFINES="${DEFINES} -DMAX_HEIGHT=${withval}";
1538 AS_IF([test "${withval}" -gt "4096"],
1539 [AC_MSG_WARN([Large framebuffer: see s_tritemp.h comments.])])]
1540 )
1541
1542 dnl
1543 dnl Gallium LLVM
1544 dnl
1545 AC_ARG_ENABLE([gallium-llvm],
1546 [AS_HELP_STRING([--enable-gallium-llvm],
1547 [build gallium LLVM support @<:@default=enabled on x86/x86_64@:>@])],
1548 [enable_gallium_llvm="$enableval"],
1549 [enable_gallium_llvm=auto])
1550
1551 AC_ARG_WITH([llvm-shared-libs],
1552 [AS_HELP_STRING([--with-llvm-shared-libs],
1553 [link with LLVM shared libraries @<:@default=disabled@:>@])],
1554 [],
1555 [with_llvm_shared_libs=no])
1556 AS_IF([test x$enable_opencl = xyes],
1557 [
1558 AC_MSG_WARN([OpenCL required, forcing LLVM shared libraries])
1559 with_llvm_shared_libs=yes
1560 ])
1561
1562 AC_ARG_WITH([llvm-prefix],
1563 [AS_HELP_STRING([--with-llvm-prefix],
1564 [Prefix for LLVM installations in non-standard locations])],
1565 [llvm_prefix="$withval"],
1566 [llvm_prefix=""])
1567
1568
1569 # Call this inside ` ` to get the return value.
1570 # $1 is the llvm-config command with arguments.
1571 strip_unwanted_llvm_flags() {
1572 # Use \> (marks the end of the word)
1573 echo `$1` | sed \
1574 -e 's/-DNDEBUG\>//g' \
1575 -e 's/-pedantic\>//g' \
1576 -e 's/-Wcovered-switch-default\>//g' \
1577 -e 's/-O.\>//g' \
1578 -e 's/-g\>//g' \
1579 -e 's/-Wall\>//g' \
1580 -e 's/-fomit-frame-pointer\>//g'
1581 }
1582
1583
1584 if test "x$with_gallium_drivers" = x; then
1585 enable_gallium_llvm=no
1586 fi
1587 if test "x$enable_gallium_llvm" = xauto; then
1588 case "$host_cpu" in
1589 i*86|x86_64|amd64) enable_gallium_llvm=yes;;
1590 esac
1591 fi
1592 if test "x$enable_gallium_llvm" = xyes; then
1593 if test "x$llvm_prefix" != x; then
1594 AC_PATH_PROG([LLVM_CONFIG], [llvm-config], [no], ["$llvm_prefix/bin"])
1595 else
1596 AC_PATH_PROG([LLVM_CONFIG], [llvm-config], [no])
1597 fi
1598
1599 if test "x$LLVM_CONFIG" != xno; then
1600 LLVM_VERSION=`$LLVM_CONFIG --version | sed 's/svn.*//g'`
1601 LLVM_LDFLAGS=`$LLVM_CONFIG --ldflags`
1602 LLVM_BINDIR=`$LLVM_CONFIG --bindir`
1603 LLVM_CPPFLAGS=`strip_unwanted_llvm_flags "$LLVM_CONFIG --cppflags"`
1604 LLVM_CFLAGS=$LLVM_CPPFLAGS # CPPFLAGS seem to be sufficient
1605 LLVM_CXXFLAGS=`strip_unwanted_llvm_flags "$LLVM_CONFIG --cxxflags"`
1606 LLVM_INCLUDEDIR=`$LLVM_CONFIG --includedir`
1607 LLVM_LIBDIR=`$LLVM_CONFIG --libdir`
1608
1609 AC_COMPUTE_INT([LLVM_VERSION_MAJOR], [LLVM_VERSION_MAJOR],
1610 [#include "${LLVM_INCLUDEDIR}/llvm/Config/llvm-config.h"])
1611 AC_COMPUTE_INT([LLVM_VERSION_MINOR], [LLVM_VERSION_MINOR],
1612 [#include "${LLVM_INCLUDEDIR}/llvm/Config/llvm-config.h"])
1613
1614 if test "x${LLVM_VERSION_MAJOR}" != x; then
1615 LLVM_VERSION_INT="${LLVM_VERSION_MAJOR}0${LLVM_VERSION_MINOR}"
1616 else
1617 LLVM_VERSION_INT=`echo $LLVM_VERSION | sed -e 's/\([[0-9]]\)\.\([[0-9]]\)/\10\2/g'`
1618 fi
1619
1620 LLVM_COMPONENTS="engine bitwriter"
1621 if $LLVM_CONFIG --components | grep -qw 'mcjit'; then
1622 LLVM_COMPONENTS="${LLVM_COMPONENTS} mcjit"
1623 fi
1624
1625 if test "x$enable_opencl" = xyes; then
1626 LLVM_COMPONENTS="${LLVM_COMPONENTS} ipo linker instrumentation"
1627 # LLVM 3.3 >= 177971 requires IRReader
1628 if $LLVM_CONFIG --components | grep -qw 'irreader'; then
1629 LLVM_COMPONENTS="${LLVM_COMPONENTS} irreader"
1630 fi
1631 # LLVM 3.4 requires Option
1632 if $LLVM_CONFIG --components | grep -qw 'option'; then
1633 LLVM_COMPONENTS="${LLVM_COMPONENTS} option"
1634 fi
1635 fi
1636 DEFINES="${DEFINES} -DHAVE_LLVM=0x0$LLVM_VERSION_INT"
1637 MESA_LLVM=1
1638
1639 dnl Check for Clang internal headers
1640 if test "x$enable_opencl" = xyes; then
1641 if test "x$CLANG_LIBDIR" = x; then
1642 CLANG_LIBDIR=${LLVM_LIBDIR}
1643 fi
1644 CLANG_RESOURCE_DIR=$CLANG_LIBDIR/clang/${LLVM_VERSION}
1645 AS_IF([test ! -f "$CLANG_RESOURCE_DIR/include/stddef.h"],
1646 [AC_MSG_ERROR([Could not find clang internal header stddef.h in $CLANG_RESOURCE_DIR Use --with-clang-libdir to specify the correct path to the clang libraries.])])
1647 fi
1648 else
1649 MESA_LLVM=0
1650 LLVM_VERSION_INT=0
1651 fi
1652 else
1653 MESA_LLVM=0
1654 LLVM_VERSION_INT=0
1655 fi
1656
1657 dnl Directory for XVMC libs
1658 AC_ARG_WITH([xvmc-libdir],
1659 [AS_HELP_STRING([--with-xvmc-libdir=DIR],
1660 [directory for the XVMC libraries @<:@default=${libdir}@:>@])],
1661 [XVMC_LIB_INSTALL_DIR="$withval"],
1662 [XVMC_LIB_INSTALL_DIR='${libdir}'])
1663 AC_SUBST([XVMC_LIB_INSTALL_DIR])
1664
1665 dnl
1666 dnl Gallium Tests
1667 dnl
1668 if test "x$enable_gallium_tests" = xyes; then
1669 enable_gallium_loader=yes
1670 fi
1671 AM_CONDITIONAL(HAVE_GALLIUM_TESTS, test "x$enable_gallium_tests" = xyes)
1672
1673 if test "x$enable_gallium_loader" = xyes; then
1674 GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS pipe-loader"
1675 fi
1676 AM_CONDITIONAL(NEED_GALLIUM_LOADER, test "x$enable_gallium_loader" = xyes)
1677
1678 dnl Directory for VDPAU libs
1679 AC_ARG_WITH([vdpau-libdir],
1680 [AS_HELP_STRING([--with-vdpau-libdir=DIR],
1681 [directory for the VDPAU libraries @<:@default=${libdir}/vdpau@:>@])],
1682 [VDPAU_LIB_INSTALL_DIR="$withval"],
1683 [VDPAU_LIB_INSTALL_DIR='${libdir}/vdpau'])
1684 AC_SUBST([VDPAU_LIB_INSTALL_DIR])
1685
1686 dnl Directory for OpenCL libs
1687 AC_ARG_WITH([opencl-libdir],
1688 [AS_HELP_STRING([--with-opencl-libdir=DIR],
1689 [directory for auxiliary libraries used by the OpenCL implementation @<:@default=${libdir}/opencl@:>@])],
1690 [OPENCL_LIB_INSTALL_DIR="$withval"],
1691 [OPENCL_LIB_INSTALL_DIR='${libdir}/opencl'])
1692 AC_SUBST([OPENCL_LIB_INSTALL_DIR])
1693
1694 dnl
1695 dnl Gallium helper functions
1696 dnl
1697 gallium_check_st() {
1698 if test "x$NEED_NONNULL_WINSYS" = xyes; then
1699 if test "x$have_libdrm" != xyes; then
1700 AC_MSG_ERROR([DRI or Xorg DDX requires libdrm >= $LIBDRM_REQUIRED])
1701 fi
1702 GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS $1"
1703 fi
1704 if test "x$enable_dri" = xyes && test "x$2" != x; then
1705 GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS $2"
1706 HAVE_COMMON_DRI=yes
1707 fi
1708 if test "x$enable_xorg" = xyes && test "x$3" != x; then
1709 GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS $3"
1710 fi
1711 if test "x$enable_xa" = xyes && test "x$4" != x; then
1712 GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS $4"
1713 fi
1714 if test "x$enable_xvmc" = xyes && test "x$5" != x; then
1715 GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS $5"
1716 fi
1717 if test "x$enable_vdpau" = xyes && test "x$6" != x; then
1718 GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS $6"
1719 fi
1720 }
1721
1722 gallium_require_llvm() {
1723 if test "x$MESA_LLVM" = x0; then
1724 case "$host_cpu" in
1725 i*86|x86_64|amd64) AC_MSG_ERROR([LLVM is required to build $1 on x86 and x86_64]);;
1726 esac
1727 fi
1728 }
1729
1730 gallium_require_drm_loader() {
1731 if test "x$enable_gallium_loader" = xyes; then
1732 PKG_CHECK_MODULES([LIBUDEV], [libudev], [],
1733 AC_MSG_ERROR([Gallium drm loader requires libudev]))
1734 if test "x$have_libdrm" != xyes; then
1735 AC_MSG_ERROR([Gallium drm loader requires libdrm >= $LIBDRM_REQUIRED])
1736 fi
1737 enable_gallium_drm_loader=yes
1738 fi
1739 }
1740
1741 radeon_llvm_check() {
1742 LLVM_REQUIRED_VERSION_MAJOR="3"
1743 LLVM_REQUIRED_VERSION_MINOR="3"
1744 if test "$LLVM_VERSION_INT" -lt "${LLVM_REQUIRED_VERSION_MAJOR}0${LLVM_REQUIRED_VERSION_MINOR}"; then
1745 AC_MSG_ERROR([LLVM $LLVM_REQUIRED_VERSION_MAJOR.$LLVM_REQUIRED_VERSION_MINOR or newer is required for r600g and radeonsi.])
1746 fi
1747 if test true && $LLVM_CONFIG --targets-built | grep -qvw 'R600' ; then
1748 AC_MSG_ERROR([LLVM R600 Target not enabled. You can enable it when building the LLVM
1749 sources with the --enable-experimental-targets=R600
1750 configure flag])
1751 fi
1752 LLVM_COMPONENTS="${LLVM_COMPONENTS} r600 bitreader ipo"
1753 NEED_RADEON_LLVM=yes
1754 AC_CHECK_LIB([elf], [elf_memory], [ELF_LIB=-lelf],
1755 [AC_MSG_ERROR([radeonsi and r600g require libelf when using LLVM])])
1756 }
1757
1758 dnl Gallium drivers
1759 if test "x$enable_dri" = xyes -o "x$enable_xorg" = xyes -o \
1760 "x$enable_xa" = xyes -o "x$enable_xvmc" = xyes -o \
1761 "x$enable_vdpau" = xyes; then
1762 NEED_NONNULL_WINSYS=yes
1763 fi
1764 AM_CONDITIONAL(NEED_NONNULL_WINSYS, test "x$NEED_NONNULL_WINSYS" = xyes)
1765
1766 dnl Duplicates in GALLIUM_DRIVERS_DIRS are removed by sorting it after this block
1767 if test "x$with_gallium_drivers" != x; then
1768 gallium_drivers=`IFS=', '; echo $with_gallium_drivers`
1769 for driver in $gallium_drivers; do
1770 case "x$driver" in
1771 xsvga)
1772 HAVE_GALLIUM_SVGA=yes
1773 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS svga softpipe"
1774 gallium_check_st "svga/drm" "dri-vmwgfx" "" "xa-vmwgfx"
1775 ;;
1776 xi915)
1777 HAVE_GALLIUM_I915=yes
1778 PKG_CHECK_MODULES([INTEL], [libdrm_intel >= $LIBDRM_INTEL_REQUIRED])
1779 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS i915 softpipe"
1780 if test "x$MESA_LLVM" = x1; then
1781 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS llvmpipe"
1782 fi
1783 GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS i915/sw"
1784 gallium_check_st "i915/drm" "dri-i915" "xorg-i915"
1785 ;;
1786 xilo)
1787 HAVE_GALLIUM_ILO=yes
1788 PKG_CHECK_MODULES([INTEL], [libdrm_intel >= $LIBDRM_INTEL_REQUIRED])
1789 gallium_require_drm_loader
1790 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS ilo"
1791 gallium_check_st "intel/drm" "dri-ilo"
1792 ;;
1793 xr300)
1794 HAVE_GALLIUM_R300=yes
1795 PKG_CHECK_MODULES([RADEON], [libdrm_radeon >= $LIBDRM_RADEON_REQUIRED])
1796 gallium_require_llvm "Gallium R300"
1797 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r300"
1798 gallium_check_st "radeon/drm" "dri-r300" "" "" "xvmc-r300" "vdpau-r300"
1799 ;;
1800 xr600)
1801 HAVE_GALLIUM_R600=yes
1802 PKG_CHECK_MODULES([RADEON], [libdrm_radeon >= $LIBDRM_RADEON_REQUIRED])
1803 gallium_require_drm_loader
1804 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r600"
1805 if test "x$enable_r600_llvm" = xyes -o "x$enable_opencl" = xyes; then
1806 radeon_llvm_check
1807 R600_NEED_RADEON_GALLIUM=yes;
1808 LLVM_COMPONENTS="${LLVM_COMPONENTS} bitreader asmparser"
1809 fi
1810 if test "x$enable_r600_llvm" = xyes; then
1811 USE_R600_LLVM_COMPILER=yes;
1812 fi
1813 if test "x$enable_opencl" = xyes; then
1814 LLVM_COMPONENTS="${LLVM_COMPONENTS} bitreader asmparser"
1815 fi
1816 gallium_check_st "radeon/drm" "dri-r600" "xorg-r600" "" "xvmc-r600" "vdpau-r600"
1817 ;;
1818 xradeonsi)
1819 HAVE_GALLIUM_RADEONSI=yes
1820 PKG_CHECK_MODULES([RADEON], [libdrm_radeon >= $LIBDRM_RADEON_REQUIRED])
1821 gallium_require_drm_loader
1822 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS radeonsi"
1823 radeon_llvm_check
1824 gallium_check_st "radeon/drm" "dri-radeonsi" "xorg-radeonsi" "" "" "vdpau-radeonsi" ""
1825 ;;
1826 xnouveau)
1827 HAVE_GALLIUM_NOUVEAU=yes
1828 PKG_CHECK_MODULES([NOUVEAU], [libdrm_nouveau >= $LIBDRM_NOUVEAU_REQUIRED])
1829 gallium_require_drm_loader
1830 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS nouveau nv30 nv50 nvc0"
1831 gallium_check_st "nouveau/drm" "dri-nouveau" "xorg-nouveau" "" "xvmc-nouveau" "vdpau-nouveau"
1832 ;;
1833 xfreedreno)
1834 HAVE_GALLIUM_FREEDRENO=yes
1835 PKG_CHECK_MODULES([FREEDRENO], [libdrm_freedreno >= $LIBDRM_FREEDRENO_REQUIRED])
1836 gallium_require_drm_loader
1837 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS freedreno"
1838 gallium_check_st "freedreno/drm" "dri-freedreno" "" "" "" ""
1839 ;;
1840 xswrast)
1841 HAVE_GALLIUM_SOFTPIPE=yes
1842 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS softpipe"
1843 if test "x$MESA_LLVM" = x1; then
1844 HAVE_GALLIUM_LLVMPIPE=yes
1845 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS llvmpipe"
1846 fi
1847
1848 if test "x$enable_dri" = xyes; then
1849 GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS dri-swrast"
1850 HAVE_COMMON_DRI=yes
1851 fi
1852 if test "x$enable_vdpau" = xyes; then
1853 GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS vdpau-softpipe"
1854 fi
1855 if test "x$enable_xvmc" = xyes; then
1856 GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS xvmc-softpipe"
1857 fi
1858 if test "x$enable_vdpau" = xyes -o "x$enable_xvmc" = xyes; then
1859 NEED_WINSYS_XLIB=yes
1860 GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS sw/xlib"
1861 fi
1862 ;;
1863 *)
1864 AC_MSG_ERROR([Unknown Gallium driver: $driver])
1865 ;;
1866 esac
1867 done
1868 fi
1869
1870 dnl Set LLVM_LIBS - This is done after the driver configuration so
1871 dnl that drivers can add additonal components to LLVM_COMPONENTS.
1872 dnl Previously, gallium drivers were updating LLVM_LIBS directly
1873 dnl by calling llvm-config --libs ${DRIVER_LLVM_COMPONENTS}, but
1874 dnl this was causing the same libraries to be appear multiple times
1875 dnl in LLVM_LIBS.
1876
1877 if test "x$MESA_LLVM" != x0; then
1878
1879 LLVM_LIBS="`$LLVM_CONFIG --libs ${LLVM_COMPONENTS}`"
1880
1881 if test "x$with_llvm_shared_libs" = xyes; then
1882 dnl We can't use $LLVM_VERSION because it has 'svn' stripped out,
1883 LLVM_SO_NAME=LLVM-`$LLVM_CONFIG --version`
1884 AS_IF([test -f "$LLVM_LIBDIR/lib$LLVM_SO_NAME.so"], [llvm_have_one_so=yes])
1885
1886 if test "x$llvm_have_one_so" = xyes; then
1887 dnl LLVM was built using auto*, so there is only one shared object.
1888 LLVM_LIBS="-l$LLVM_SO_NAME"
1889 else
1890 dnl If LLVM was built with CMake, there will be one shared object per
1891 dnl component.
1892 AS_IF([test ! -f "$LLVM_LIBDIR/libLLVMTarget.so"],
1893 [AC_MSG_ERROR([Could not find llvm shared libraries:
1894 Please make sure you have built llvm with the --enable-shared option
1895 and that your llvm libraries are installed in $LLVM_LIBDIR
1896 If you have installed your llvm libraries to a different directory you
1897 can use the --with-llvm-prefix= configure flag to specify this directory.
1898 NOTE: Mesa is attempting to use llvm shared libraries because you have
1899 passed one of the following options to configure:
1900 --with-llvm-shared-libs
1901 --enable-opencl
1902 If you do not want to build with llvm shared libraries and instead want to
1903 use llvm static libraries then remove these options from your configure
1904 invocation and reconfigure.])])
1905
1906 dnl We don't need to update LLVM_LIBS in this case because the LLVM
1907 dnl install uses a shared object for each compoenent and we have
1908 dnl already added all of these objects to LLVM_LIBS.
1909 fi
1910 fi
1911 fi
1912
1913 AM_CONDITIONAL(HAVE_GALLIUM_SVGA, test "x$HAVE_GALLIUM_SVGA" = xyes)
1914 AM_CONDITIONAL(HAVE_GALLIUM_I915, test "x$HAVE_GALLIUM_I915" = xyes)
1915 AM_CONDITIONAL(HAVE_GALLIUM_ILO, test "x$HAVE_GALLIUM_ILO" = xyes)
1916 AM_CONDITIONAL(HAVE_GALLIUM_R300, test "x$HAVE_GALLIUM_R300" = xyes)
1917 AM_CONDITIONAL(HAVE_GALLIUM_R600, test "x$HAVE_GALLIUM_R600" = xyes)
1918 AM_CONDITIONAL(HAVE_GALLIUM_RADEONSI, test "x$HAVE_GALLIUM_RADEONSI" = xyes)
1919 AM_CONDITIONAL(HAVE_GALLIUM_NOUVEAU, test "x$HAVE_GALLIUM_NOUVEAU" = xyes)
1920 AM_CONDITIONAL(HAVE_GALLIUM_FREEDRENO, test "x$HAVE_GALLIUM_FREEDRENO" = xyes)
1921 AM_CONDITIONAL(HAVE_GALLIUM_SOFTPIPE, test "x$HAVE_GALLIUM_SOFTPIPE" = xyes)
1922 AM_CONDITIONAL(HAVE_GALLIUM_LLVMPIPE, test "x$HAVE_GALLIUM_LLVMPIPE" = xyes)
1923
1924 AM_CONDITIONAL(NEED_GALLIUM_SOFTPIPE_DRIVER, test "x$HAVE_GALLIUM_SVGA" = xyes -o \
1925 "x$HAVE_GALLIUM_I915" = xyes -o \
1926 "x$HAVE_GALLIUM_SOFTPIPE" = xyes)
1927 AM_CONDITIONAL(NEED_GALLIUM_LLVMPIPE_DRIVER, test "x$HAVE_GALLIUM_I915" = xyes -o \
1928 "x$HAVE_GALLIUM_SOFTPIPE" = xyes \
1929 && test "x$MESA_LLVM" = x1)
1930
1931 if test "x$enable_gallium_loader" = xyes; then
1932 GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS sw/null"
1933
1934 if test "x$enable_gallium_drm_loader" = xyes; then
1935 GALLIUM_PIPE_LOADER_DEFINES="$GALLIUM_PIPE_LOADER_DEFINES -DHAVE_PIPE_LOADER_DRM"
1936 PKG_CHECK_MODULES([GALLIUM_PIPE_LOADER_XCB], [xcb xcb-dri2],
1937 pipe_loader_have_xcb=yes, pipe_loader_have_xcb=no)
1938 if test "x$pipe_loader_have_xcb" = xyes; then
1939 GALLIUM_PIPE_LOADER_DEFINES="$GALLIUM_PIPE_LOADER_DEFINES -DHAVE_PIPE_LOADER_XCB"
1940 GALLIUM_PIPE_LOADER_LIBS="$GALLIUM_PIPE_LOADER_LIBS $GALLIUM_PIPE_LOADER_XCB_LIBS $LIBDRM_LIBS"
1941 fi
1942 fi
1943
1944 AC_SUBST([GALLIUM_PIPE_LOADER_DEFINES])
1945 AC_SUBST([GALLIUM_PIPE_LOADER_LIBS])
1946 fi
1947
1948 AM_CONDITIONAL(HAVE_I915_DRI, test x$HAVE_I915_DRI = xyes)
1949 AM_CONDITIONAL(HAVE_I965_DRI, test x$HAVE_I965_DRI = xyes)
1950 AM_CONDITIONAL(HAVE_NOUVEAU_DRI, test x$HAVE_NOUVEAU_DRI = xyes)
1951 AM_CONDITIONAL(HAVE_R200_DRI, test x$HAVE_R200_DRI = xyes)
1952 AM_CONDITIONAL(HAVE_RADEON_DRI, test x$HAVE_RADEON_DRI = xyes)
1953 AM_CONDITIONAL(HAVE_SWRAST_DRI, test x$HAVE_SWRAST_DRI = xyes)
1954 AM_CONDITIONAL(HAVE_COMMON_DRI, test x$HAVE_COMMON_DRI = xyes)
1955
1956 AM_CONDITIONAL(NEED_RADEON_DRM_WINSYS, test "x$NEED_NONNULL_WINSYS" = xyes -a \
1957 "x$HAVE_GALLIUM_R300" = xyes -o \
1958 "x$HAVE_GALLIUM_R600" = xyes -o \
1959 "x$HAVE_GALLIUM_RADEONSI" = xyes)
1960 AM_CONDITIONAL(NEED_WINSYS_WRAPPER, test "x$HAVE_GALLIUM_I915" = xyes -o \
1961 "x$HAVE_GALLIUM_SVGA" = xyes)
1962 AM_CONDITIONAL(NEED_WINSYS_XLIB, test "x$NEED_WINSYS_XLIB" = xyes)
1963 AM_CONDITIONAL(NEED_RADEON_LLVM, test x$NEED_RADEON_LLVM = xyes)
1964 AM_CONDITIONAL(R600_NEED_RADEON_GALLIUM, test x$R600_NEED_RADEON_GALLIUM = xyes)
1965 AM_CONDITIONAL(USE_R600_LLVM_COMPILER, test x$USE_R600_LLVM_COMPILER = xyes)
1966 AM_CONDITIONAL(HAVE_LOADER_GALLIUM, test x$enable_gallium_loader = xyes)
1967 AM_CONDITIONAL(HAVE_DRM_LOADER_GALLIUM, test x$enable_gallium_drm_loader = xyes)
1968 AM_CONDITIONAL(HAVE_GALLIUM_COMPUTE, test x$enable_opencl = xyes)
1969 AM_CONDITIONAL(HAVE_MESA_LLVM, test x$MESA_LLVM = x1)
1970 AM_CONDITIONAL(LLVM_NEEDS_FNORTTI, test $LLVM_VERSION_INT -ge 302)
1971
1972 AC_SUBST([ELF_LIB])
1973
1974 AM_CONDITIONAL(NEED_LIBPROGRAM, test "x$with_gallium_drivers" != x -o \
1975 "x$enable_xlib_glx" = xyes -o \
1976 "x$enable_osmesa" = xyes -o \
1977 "x$enable_gallium_osmesa" = xyes)
1978 AM_CONDITIONAL(HAVE_X11_DRIVER, test "x$enable_xlib_glx" = xyes)
1979 AM_CONDITIONAL(HAVE_OSMESA, test "x$enable_osmesa" = xyes)
1980 AM_CONDITIONAL(HAVE_GALLIUM_OSMESA, test "x$enable_gallium_osmesa" = xyes)
1981
1982 AM_CONDITIONAL(HAVE_X86_ASM, echo "$DEFINES" | grep 'X86_ASM' >/dev/null 2>&1)
1983 AM_CONDITIONAL(HAVE_X86_64_ASM, echo "$DEFINES" | grep 'X86_64_ASM' >/dev/null 2>&1)
1984 AM_CONDITIONAL(HAVE_SPARC_ASM, echo "$DEFINES" | grep 'SPARC_ASM' >/dev/null 2>&1)
1985
1986 AM_CONDITIONAL(CROSS_COMPILING, test "x$cross_compiling" = xyes)
1987
1988 AC_SUBST([VDPAU_MAJOR], 1)
1989 AC_SUBST([VDPAU_MINOR], 0)
1990
1991 AC_SUBST([XVMC_MAJOR], 1)
1992 AC_SUBST([XVMC_MINOR], 0)
1993
1994 AC_SUBST([XA_MAJOR], 2)
1995 AC_SUBST([XA_MINOR], 0)
1996 AC_SUBST([XA_TINY], 0)
1997 AC_SUBST([XA_VERSION], "$XA_MAJOR.$XA_MINOR.$XA_TINY")
1998
1999 dnl Restore LDFLAGS and CPPFLAGS
2000 LDFLAGS="$_SAVE_LDFLAGS"
2001 CPPFLAGS="$_SAVE_CPPFLAGS"
2002
2003 dnl Add user CFLAGS and CXXFLAGS
2004 CFLAGS="$CFLAGS $USER_CFLAGS"
2005 CXXFLAGS="$CXXFLAGS $USER_CXXFLAGS"
2006
2007 dnl Substitute the config
2008 AC_CONFIG_FILES([Makefile
2009 src/Makefile
2010 src/egl/Makefile
2011 src/egl/drivers/Makefile
2012 src/egl/drivers/dri2/Makefile
2013 src/egl/drivers/glx/Makefile
2014 src/egl/main/Makefile
2015 src/egl/main/egl.pc
2016 src/egl/wayland/Makefile
2017 src/egl/wayland/wayland-drm/Makefile
2018 src/egl/wayland/wayland-egl/Makefile
2019 src/egl/wayland/wayland-egl/wayland-egl.pc
2020 src/gallium/auxiliary/Makefile
2021 src/gallium/auxiliary/pipe-loader/Makefile
2022 src/gallium/drivers/Makefile
2023 src/gallium/drivers/freedreno/Makefile
2024 src/gallium/drivers/freedreno/a2xx/Makefile
2025 src/gallium/drivers/freedreno/a3xx/Makefile
2026 src/gallium/drivers/i915/Makefile
2027 src/gallium/drivers/ilo/Makefile
2028 src/gallium/drivers/llvmpipe/Makefile
2029 src/gallium/drivers/nouveau/Makefile
2030 src/gallium/drivers/nv30/Makefile
2031 src/gallium/drivers/nv50/Makefile
2032 src/gallium/drivers/nvc0/Makefile
2033 src/gallium/drivers/r300/Makefile
2034 src/gallium/drivers/r600/Makefile
2035 src/gallium/drivers/radeon/Makefile
2036 src/gallium/drivers/radeonsi/Makefile
2037 src/gallium/drivers/rbug/Makefile
2038 src/gallium/drivers/softpipe/Makefile
2039 src/gallium/drivers/svga/Makefile
2040 src/gallium/drivers/trace/Makefile
2041 src/gallium/state_trackers/Makefile
2042 src/gallium/state_trackers/clover/Makefile
2043 src/gallium/state_trackers/dri/Makefile
2044 src/gallium/state_trackers/dri/drm/Makefile
2045 src/gallium/state_trackers/dri/sw/Makefile
2046 src/gallium/state_trackers/egl/Makefile
2047 src/gallium/state_trackers/gbm/Makefile
2048 src/gallium/state_trackers/glx/Makefile
2049 src/gallium/state_trackers/osmesa/Makefile
2050 src/gallium/state_trackers/vdpau/Makefile
2051 src/gallium/state_trackers/vega/Makefile
2052 src/gallium/state_trackers/xa/Makefile
2053 src/gallium/state_trackers/xorg/Makefile
2054 src/gallium/state_trackers/xvmc/Makefile
2055 src/gallium/targets/Makefile
2056 src/gallium/targets/dri-freedreno/Makefile
2057 src/gallium/targets/dri-i915/Makefile
2058 src/gallium/targets/dri-ilo/Makefile
2059 src/gallium/targets/dri-nouveau/Makefile
2060 src/gallium/targets/dri-r300/Makefile
2061 src/gallium/targets/dri-r600/Makefile
2062 src/gallium/targets/dri-radeonsi/Makefile
2063 src/gallium/targets/dri-swrast/Makefile
2064 src/gallium/targets/dri-vmwgfx/Makefile
2065 src/gallium/targets/egl-static/Makefile
2066 src/gallium/targets/gbm/Makefile
2067 src/gallium/targets/opencl/Makefile
2068 src/gallium/targets/osmesa/Makefile
2069 src/gallium/targets/osmesa/osmesa.pc
2070 src/gallium/targets/pipe-loader/Makefile
2071 src/gallium/targets/libgl-xlib/Makefile
2072 src/gallium/targets/vdpau-nouveau/Makefile
2073 src/gallium/targets/vdpau-r300/Makefile
2074 src/gallium/targets/vdpau-r600/Makefile
2075 src/gallium/targets/vdpau-radeonsi/Makefile
2076 src/gallium/targets/vdpau-softpipe/Makefile
2077 src/gallium/targets/xa-vmwgfx/Makefile
2078 src/gallium/targets/xa-vmwgfx/xatracker.pc
2079 src/gallium/targets/xorg-i915/Makefile
2080 src/gallium/targets/xorg-nouveau/Makefile
2081 src/gallium/targets/xorg-r600/Makefile
2082 src/gallium/targets/xorg-radeonsi/Makefile
2083 src/gallium/targets/xvmc-nouveau/Makefile
2084 src/gallium/targets/xvmc-r300/Makefile
2085 src/gallium/targets/xvmc-r600/Makefile
2086 src/gallium/targets/xvmc-softpipe/Makefile
2087 src/gallium/tests/trivial/Makefile
2088 src/gallium/tests/unit/Makefile
2089 src/gallium/winsys/Makefile
2090 src/gallium/winsys/freedreno/drm/Makefile
2091 src/gallium/winsys/i915/drm/Makefile
2092 src/gallium/winsys/i915/sw/Makefile
2093 src/gallium/winsys/intel/drm/Makefile
2094 src/gallium/winsys/nouveau/drm/Makefile
2095 src/gallium/winsys/radeon/drm/Makefile
2096 src/gallium/winsys/svga/drm/Makefile
2097 src/gallium/winsys/sw/dri/Makefile
2098 src/gallium/winsys/sw/fbdev/Makefile
2099 src/gallium/winsys/sw/null/Makefile
2100 src/gallium/winsys/sw/wayland/Makefile
2101 src/gallium/winsys/sw/wrapper/Makefile
2102 src/gallium/winsys/sw/xlib/Makefile
2103 src/gbm/Makefile
2104 src/gbm/main/gbm.pc
2105 src/glsl/Makefile
2106 src/glsl/builtin_compiler/Makefile
2107 src/glx/Makefile
2108 src/glx/tests/Makefile
2109 src/gtest/Makefile
2110 src/mapi/Makefile
2111 src/mapi/es1api/Makefile
2112 src/mapi/es1api/glesv1_cm.pc
2113 src/mapi/es2api/Makefile
2114 src/mapi/es2api/glesv2.pc
2115 src/mapi/glapi/Makefile
2116 src/mapi/glapi/gen/Makefile
2117 src/mapi/glapi/tests/Makefile
2118 src/mapi/shared-glapi/Makefile
2119 src/mapi/shared-glapi/tests/Makefile
2120 src/mapi/vgapi/Makefile
2121 src/mapi/vgapi/vg.pc
2122 src/mesa/Makefile
2123 src/mesa/gl.pc
2124 src/mesa/drivers/dri/dri.pc
2125 src/mesa/drivers/dri/common/Makefile
2126 src/mesa/drivers/dri/common/xmlpool/Makefile
2127 src/mesa/drivers/dri/i915/Makefile
2128 src/mesa/drivers/dri/i965/Makefile
2129 src/mesa/drivers/dri/Makefile
2130 src/mesa/drivers/dri/nouveau/Makefile
2131 src/mesa/drivers/dri/r200/Makefile
2132 src/mesa/drivers/dri/radeon/Makefile
2133 src/mesa/drivers/dri/swrast/Makefile
2134 src/mesa/drivers/osmesa/Makefile
2135 src/mesa/drivers/osmesa/osmesa.pc
2136 src/mesa/drivers/x11/Makefile
2137 src/mesa/libdricore/Makefile
2138 src/mesa/main/tests/Makefile
2139 src/mesa/main/tests/hash_table/Makefile
2140 src/mesa/program/Makefile
2141 src/mesa/x86-64/Makefile
2142 src/mesa/x86/Makefile])
2143
2144 dnl Sort the dirs alphabetically
2145 GALLIUM_TARGET_DIRS=`echo $GALLIUM_TARGET_DIRS|tr " " "\n"|sort -u|tr "\n" " "`
2146 GALLIUM_WINSYS_DIRS=`echo $GALLIUM_WINSYS_DIRS|tr " " "\n"|sort -u|tr "\n" " "`
2147 GALLIUM_DRIVERS_DIRS=`echo $GALLIUM_DRIVERS_DIRS|tr " " "\n"|sort -u|tr "\n" " "`
2148 GALLIUM_STATE_TRACKERS_DIRS=`echo $GALLIUM_STATE_TRACKERS_DIRS|tr " " "\n"|sort -u|tr "\n" " "`
2149
2150 AC_OUTPUT
2151
2152 dnl
2153 dnl Output some configuration info for the user
2154 dnl
2155 echo ""
2156 echo " prefix: $prefix"
2157 echo " exec_prefix: $exec_prefix"
2158 echo " libdir: $libdir"
2159 echo " includedir: $includedir"
2160
2161 dnl API info
2162 echo ""
2163 echo " OpenGL: $enable_opengl (ES1: $enable_gles1 ES2: $enable_gles2)"
2164 echo " OpenVG: $enable_openvg"
2165
2166 dnl Driver info
2167 echo ""
2168 case "x$enable_osmesa$enable_gallium_osmesa" in
2169 xnoyes)
2170 echo " OSMesa: lib$OSMESA_LIB (Gallium)"
2171 ;;
2172 xyesno)
2173 echo " OSMesa: lib$OSMESA_LIB"
2174 ;;
2175 xnono)
2176 echo " OSMesa: no"
2177 ;;
2178 esac
2179
2180 if test "x$enable_dri" != xno; then
2181 # cleanup the drivers var
2182 dri_dirs=`echo $DRI_DIRS | $SED 's/^ *//;s/ */ /;s/ *$//'`
2183 if test "x$DRI_DIRS" = x; then
2184 echo " DRI drivers: no"
2185 else
2186 echo " DRI drivers: $dri_dirs"
2187 fi
2188 echo " DRI driver dir: $DRI_DRIVER_INSTALL_DIR"
2189 fi
2190
2191 case "x$enable_glx$enable_xlib_glx" in
2192 xyesyes)
2193 echo " GLX: Xlib-based"
2194 ;;
2195 xyesno)
2196 echo " GLX: DRI-based"
2197 ;;
2198 *)
2199 echo " GLX: $enable_glx"
2200 ;;
2201 esac
2202
2203 dnl EGL
2204 echo ""
2205 echo " EGL: $enable_egl"
2206 if test "$enable_egl" = yes; then
2207 echo " EGL platforms: $egl_platforms"
2208
2209 egl_drivers=""
2210 if test "x$HAVE_EGL_DRIVER_GLX" != "x"; then
2211 egl_drivers="$egl_drivers builtin:egl_glx"
2212 fi
2213 if test "x$HAVE_EGL_DRIVER_DRI2" != "x"; then
2214 egl_drivers="$egl_drivers builtin:egl_dri2"
2215 fi
2216
2217 if test "x$enable_gallium_egl" = xyes; then
2218 echo " EGL drivers: ${egl_drivers} egl_gallium"
2219 echo " EGL Gallium STs:$EGL_CLIENT_APIS"
2220 else
2221 echo " EGL drivers: $egl_drivers"
2222 fi
2223 fi
2224
2225 echo ""
2226 if test "x$MESA_LLVM" = x1; then
2227 echo " llvm: yes"
2228 echo " llvm-config: $LLVM_CONFIG"
2229 echo " llvm-version: $LLVM_VERSION"
2230 else
2231 echo " llvm: no"
2232 fi
2233
2234 echo ""
2235 if test -n "$with_gallium_drivers"; then
2236 echo " Gallium: yes"
2237 echo " Target dirs: $GALLIUM_TARGET_DIRS"
2238 echo " Winsys dirs: $GALLIUM_WINSYS_DIRS"
2239 echo " Driver dirs: $GALLIUM_DRIVERS_DIRS"
2240 echo " Trackers dirs: $GALLIUM_STATE_TRACKERS_DIRS"
2241 else
2242 echo " Gallium: no"
2243 fi
2244
2245
2246 dnl Libraries
2247 echo ""
2248 echo " Shared libs: $enable_shared"
2249 echo " Static libs: $enable_static"
2250 echo " Shared-glapi: $enable_shared_glapi"
2251
2252 dnl Compiler options
2253 # cleanup the CFLAGS/CXXFLAGS/DEFINES vars
2254 cflags=`echo $CFLAGS | \
2255 $SED 's/^ *//;s/ */ /;s/ *$//'`
2256 cxxflags=`echo $CXXFLAGS | \
2257 $SED 's/^ *//;s/ */ /;s/ *$//'`
2258 defines=`echo $DEFINES | $SED 's/^ *//;s/ */ /;s/ *$//'`
2259 echo ""
2260 echo " CFLAGS: $cflags"
2261 echo " CXXFLAGS: $cxxflags"
2262 echo " Macros: $defines"
2263 echo ""
2264 if test "x$MESA_LLVM" = x1; then
2265 echo " LLVM_CFLAGS: $LLVM_CFLAGS"
2266 echo " LLVM_CXXFLAGS: $LLVM_CXXFLAGS"
2267 echo " LLVM_CPPFLAGS: $LLVM_CPPFLAGS"
2268 echo ""
2269 fi
2270 echo " PYTHON2: $PYTHON2"
2271
2272 echo ""
2273 echo " Run '${MAKE-make}' to build Mesa"
2274 echo ""