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