1 dnl Process this file with autoconf to create configure.
5 dnl Versioning - scrape the version from configs/default
6 m4_define([mesa_version],
7 [m4_esyscmd([${MAKE-make} -s -f bin/version.mk version | tr -d '\n' | tr -d '\r'])])
8 m4_ifval(mesa_version,,
9 [m4_fatal([Failed to get the Mesa version from `make -f bin/version.mk version`])])
11 dnl Tell the user about autoconf.html in the --help output
12 m4_divert_once([HELP_END], [
13 See docs/autoconf.html for more details on the options for Mesa.])
15 AC_INIT([Mesa],[mesa_version],
16 [https://bugs.freedesktop.org/enter_bug.cgi?product=Mesa])
17 AC_CONFIG_AUX_DIR([bin])
19 AM_INIT_AUTOMAKE([foreign])
21 dnl http://people.gnome.org/~walters/docs/build-api.txt
22 dnl We don't support srcdir != builddir.
23 echo \#buildapi-variable-no-builddir >/dev/null
25 # Support silent build rules, requires at least automake-1.11. Disable
26 # by either passing --disable-silent-rules to configure or passing V=1
28 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
31 LT_INIT([disable-static])
33 dnl Save user CFLAGS and CXXFLAGS so one can override the default ones
35 USER_CXXFLAGS="$CXXFLAGS"
37 dnl Versions for external dependencies
38 LIBDRM_REQUIRED=2.4.24
39 LIBDRM_RADEON_REQUIRED=2.4.31
40 LIBDRM_INTEL_REQUIRED=2.4.32
41 LIBDRM_NVVIEUX_REQUIRED=2.4.33
42 LIBDRM_NOUVEAU_REQUIRED=2.4.33
43 DRI2PROTO_REQUIRED=2.6
44 GLPROTO_REQUIRED=1.4.14
45 LIBDRM_XORG_REQUIRED=2.4.24
46 LIBKMS_XORG_REQUIRED=1.0.0
52 AC_CHECK_PROGS([MAKE], [gmake make])
53 AC_CHECK_PROGS([PYTHON2], [python2 python])
56 AC_PATH_PROG([MKDEP], [makedepend])
58 if test "x$MKDEP" = "x"; then
59 AC_MSG_ERROR([makedepend is required to build Mesa])
63 AC_PATH_PROG([YACC_INST], $YACC)
64 if test ! -f "$srcdir/src/glsl/glcpp/glcpp-parse.y"; then
65 if test -z "$YACC_INST"; then
66 AC_MSG_ERROR([yacc not found - unable to compile glcpp-parse.y])
71 AC_PATH_PROG([PERL], [perl])
73 dnl Our fallback install-sh is a symlink to minstall. Use the existing
74 dnl configuration in that case.
76 test "x$INSTALL" = "x$ac_install_sh" && INSTALL='$(MINSTALL)'
78 dnl We need a POSIX shell for parts of the build. Assume we have one
82 # Solaris /bin/sh is too old/non-POSIX compliant
83 AC_PATH_PROGS(POSIX_SHELL, [ksh93 ksh sh])
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])
93 [AC_LANG_PROGRAM([], [[
98 [acv_mesa_CLANG=yes], [acv_mesa_CLANG=no])
100 AC_MSG_RESULT([$acv_mesa_CLANG])
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 if test "x$GCC" = xyes -a "x$acv_mesa_CLANG" = xno; then
105 AC_MSG_CHECKING([whether gcc version is sufficient])
109 GCC_VERSION=`$CC -dumpversion`
110 if test $? -eq 0; then
111 major=`echo $GCC_VERSION | cut -d. -f1`
112 minor=`echo $GCC_VERSION | cut -d. -f2`
115 if test $major -lt 3 -o $major -eq 3 -a $minor -lt 3 ; then
117 AC_MSG_ERROR([If using GCC, version 3.3.0 or later is required.])
124 MKDEP_OPTIONS=-fdepend
125 dnl Ask gcc where it's keeping its secret headers
126 if test "x$GCC" = xyes; then
127 for dir in include include-fixed; do
128 GCC_INCLUDES=`$CC -print-file-name=$dir`
129 if test "x$GCC_INCLUDES" != x && \
130 test "$GCC_INCLUDES" != "$dir" && \
131 test -d "$GCC_INCLUDES"; then
132 MKDEP_OPTIONS="$MKDEP_OPTIONS -I$GCC_INCLUDES"
136 AC_SUBST([MKDEP_OPTIONS])
138 dnl Make sure the pkg-config macros are defined
139 m4_ifndef([PKG_PROG_PKG_CONFIG],
140 [m4_fatal([Could not locate the pkg-config autoconf macros.
141 These are usually located in /usr/share/aclocal/pkg.m4. If your macros
142 are in a different location, try setting the environment variable
143 ACLOCAL="aclocal -I/other/macro/dir" before running autoreconf.])])
144 PKG_PROG_PKG_CONFIG()
146 dnl LIB_DIR - library basename
147 LIB_DIR=`echo $libdir | $SED 's%.*/%%'`
150 dnl Cache LDFLAGS so we can add EXTRA_LIB_PATH and restore it later
151 _SAVE_LDFLAGS="$LDFLAGS"
152 AC_ARG_VAR([EXTRA_LIB_PATH],[Extra -L paths for the linker])
153 AC_SUBST([EXTRA_LIB_PATH])
155 dnl Cache CPPFLAGS so we can add *_INCLUDES and restore it later
156 _SAVE_CPPFLAGS="$CPPFLAGS"
157 AC_ARG_VAR([X11_INCLUDES],[Extra -I paths for X11 headers])
158 AC_SUBST([X11_INCLUDES])
165 DEFINES="$DEFINES -D_GNU_SOURCE -DPTHREADS"
168 DEFINES="$DEFINES -DPTHREADS -DSVR4"
171 DEFINES="$DEFINES -DPTHREADS"
175 dnl Add flags for gcc and g++
176 if test "x$GCC" = xyes; then
177 CFLAGS="$CFLAGS -Wall -std=c99"
179 # Enable -Werror=implicit-function-declaration and
180 # -Werror=missing-prototypes, if available, or otherwise, just
181 # -Wmissing-prototypes. This is particularly useful to avoid
182 # generating a loadable driver module that has undefined symbols.
183 save_CFLAGS="$CFLAGS"
184 AC_MSG_CHECKING([whether $CC supports -Werror=missing-prototypes])
185 CFLAGS="$CFLAGS -Werror=implicit-function-declaration"
186 CFLAGS="$CFLAGS -Werror=missing-prototypes"
187 AC_LINK_IFELSE([AC_LANG_PROGRAM()],
188 AC_MSG_RESULT([yes]),
189 [CFLAGS="$save_CFLAGS -Wmissing-prototypes";
190 AC_MSG_RESULT([no])]);
192 # Enable -fvisibility=hidden if using a gcc that supports it
193 save_CFLAGS="$CFLAGS"
194 AC_MSG_CHECKING([whether $CC supports -fvisibility=hidden])
195 VISIBILITY_CFLAGS="-fvisibility=hidden"
196 CFLAGS="$CFLAGS $VISIBILITY_CFLAGS"
197 AC_LINK_IFELSE([AC_LANG_PROGRAM()], AC_MSG_RESULT([yes]),
198 [VISIBILITY_CFLAGS=""; AC_MSG_RESULT([no])]);
200 # Restore CFLAGS; VISIBILITY_CFLAGS are added to it where needed.
203 # Work around aliasing bugs - developers should comment this out
204 CFLAGS="$CFLAGS -fno-strict-aliasing"
206 # gcc's builtin memcmp is slower than glibc's
207 # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43052
208 CFLAGS="$CFLAGS -fno-builtin-memcmp"
210 if test "x$GXX" = xyes; then
211 CXXFLAGS="$CXXFLAGS -Wall"
213 # Enable -fvisibility=hidden if using a gcc that supports it
214 save_CXXFLAGS="$CXXFLAGS"
215 AC_MSG_CHECKING([whether $CXX supports -fvisibility=hidden])
216 VISIBILITY_CXXFLAGS="-fvisibility=hidden"
217 CXXFLAGS="$CXXFLAGS $VISIBILITY_CXXFLAGS"
219 AC_LINK_IFELSE([AC_LANG_PROGRAM()], AC_MSG_RESULT([yes]),
220 [VISIBILITY_CXXFLAGS="" ; AC_MSG_RESULT([no])]);
223 # Restore CXXFLAGS; VISIBILITY_CXXFLAGS are added to it where needed.
224 CXXFLAGS=$save_CXXFLAGS
226 # Work around aliasing bugs - developers should comment this out
227 CXXFLAGS="$CXXFLAGS -fno-strict-aliasing"
229 # gcc's builtin memcmp is slower than glibc's
230 # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43052
231 CXXFLAGS="$CXXFLAGS -fno-builtin-memcmp"
234 dnl even if the compiler appears to support it, using visibility attributes isn't
235 dnl going to do anything useful currently on cygwin apart from emit lots of warnings
239 VISIBILITY_CXXFLAGS=""
243 AC_SUBST([VISIBILITY_CFLAGS])
244 AC_SUBST([VISIBILITY_CXXFLAGS])
246 dnl These should be unnecessary, but let the user set them if they want
247 AC_ARG_VAR([OPT_FLAGS], [Additional optimization flags for the compiler.
248 Default is to use CFLAGS.])
249 AC_ARG_VAR([ARCH_FLAGS], [Additional architecture specific flags for the
250 compiler. Default is to use CFLAGS.])
251 AC_SUBST([OPT_FLAGS])
252 AC_SUBST([ARCH_FLAGS])
255 dnl Hacks to enable 32 or 64 bit build
257 AC_ARG_ENABLE([32-bit],
258 [AS_HELP_STRING([--enable-32-bit],
259 [build 32-bit libraries @<:@default=auto@:>@])],
260 [enable_32bit="$enableval"],
263 if test "x$enable_32bit" = xyes; then
264 if test "x$GCC" = xyes; then
265 CFLAGS="$CFLAGS -m32"
266 ARCH_FLAGS="$ARCH_FLAGS -m32"
268 if test "x$GXX" = xyes; then
269 CXXFLAGS="$CXXFLAGS -m32"
272 AC_ARG_ENABLE([64-bit],
273 [AS_HELP_STRING([--enable-64-bit],
274 [build 64-bit libraries @<:@default=auto@:>@])],
275 [enable_64bit="$enableval"],
278 if test "x$enable_64bit" = xyes; then
279 if test "x$GCC" = xyes; then
280 CFLAGS="$CFLAGS -m64"
282 if test "x$GXX" = xyes; then
283 CXXFLAGS="$CXXFLAGS -m64"
287 dnl Can't have static and shared libraries, default to static if user
288 dnl explicitly requested. If both disabled, set to static since shared
289 dnl was explicitly requested.
290 case "x$enable_static$enable_shared" in
292 AC_MSG_WARN([Can't build static and shared libraries, disabling shared])
296 AC_MSG_WARN([Can't disable both static and shared libraries, enabling static])
304 AC_ARG_VAR([MKLIB_OPTIONS],[Options for the Mesa library script, mklib])
305 if test "$enable_static" = yes; then
306 MKLIB_OPTIONS="$MKLIB_OPTIONS -static"
308 AC_SUBST([MKLIB_OPTIONS])
311 dnl other compiler options
313 AC_ARG_ENABLE([debug],
314 [AS_HELP_STRING([--enable-debug],
315 [use debug compiler flags and macros @<:@default=disabled@:>@])],
316 [enable_debug="$enableval"],
319 if test "x$enable_debug" = xyes; then
320 DEFINES="$DEFINES -DDEBUG"
321 if test "x$GCC" = xyes; then
324 if test "x$GXX" = xyes; then
325 CXXFLAGS="$CXXFLAGS -g"
332 LIB_PREFIX_GLOB='lib'
333 LIB_VERSION_SEPARATOR='.'
334 if test "$enable_static" = yes; then
339 LIB_EXTENSION='dylib' ;;
341 dnl prefix can be 'cyg' or 'lib'
342 LIB_PREFIX_GLOB='???'
343 LIB_VERSION_SEPARATOR='-'
344 LIB_EXTENSION='dll' ;;
348 LIB_EXTENSION='so' ;;
353 dnl Mangled Mesa support
355 AC_ARG_ENABLE([mangling],
356 [AS_HELP_STRING([--enable-mangling],
357 [enable mangled symbols and library name @<:@default=disabled@:>@])],
358 [enable_mangling="${enableval}"],
364 if test "x${enable_mangling}" = "xyes" ; then
365 DEFINES="${DEFINES} -DUSE_MGL_NAMESPACE"
368 OSMESA_LIB="MangledOSMesa"
372 AC_SUBST([OSMESA_LIB])
373 AM_CONDITIONAL(HAVE_MANGLED_GL, test $GL_LIB = MangledGL)
376 dnl potentially-infringing-but-nobody-knows-for-sure stuff
378 AC_ARG_ENABLE([texture-float],
379 [AS_HELP_STRING([--enable-texture-float],
380 [enable floating-point textures and renderbuffers @<:@default=disabled@:>@])],
381 [enable_texture_float="$enableval"],
382 [enable_texture_float=no]
384 if test "x$enable_texture_float" = xyes; then
385 AC_MSG_WARN([Floating-point textures enabled.])
386 AC_MSG_WARN([Please consult docs/patents.txt with your lawyer before building Mesa.])
387 DEFINES="$DEFINES -DTEXTURE_FLOAT_ENABLED"
390 GL_LIB_NAME='lib$(GL_LIB).'${LIB_EXTENSION}
391 GLU_LIB_NAME='lib$(GLU_LIB).'${LIB_EXTENSION}
392 OSMESA_LIB_NAME='lib$(OSMESA_LIB).'${LIB_EXTENSION}
393 EGL_LIB_NAME='lib$(EGL_LIB).'${LIB_EXTENSION}
394 GLESv1_CM_LIB_NAME='lib$(GLESv1_CM_LIB).'${LIB_EXTENSION}
395 GLESv2_LIB_NAME='lib$(GLESv2_LIB).'${LIB_EXTENSION}
396 VG_LIB_NAME='lib$(VG_LIB).'${LIB_EXTENSION}
397 GLAPI_LIB_NAME='lib$(GLAPI_LIB).'${LIB_EXTENSION}
399 GL_LIB_GLOB=${LIB_PREFIX_GLOB}'$(GL_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
400 GLU_LIB_GLOB=${LIB_PREFIX_GLOB}'$(GLU_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
401 OSMESA_LIB_GLOB=${LIB_PREFIX_GLOB}'$(OSMESA_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
402 EGL_LIB_GLOB=${LIB_PREFIX_GLOB}'$(EGL_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
403 EGL_LIB_GLOB=${LIB_PREFIX_GLOB}'$(EGL_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
404 GLESv1_CM_LIB_GLOB=${LIB_PREFIX_GLOB}'$(GLESv1_CM_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
405 GLESv2_LIB_GLOB=${LIB_PREFIX_GLOB}'$(GLESv2_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
406 VG_LIB_GLOB=${LIB_PREFIX_GLOB}'$(VG_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
407 GLAPI_LIB_GLOB=${LIB_PREFIX_GLOB}'$(GLAPI_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
409 AC_SUBST([GL_LIB_NAME])
410 AC_SUBST([GLU_LIB_NAME])
411 AC_SUBST([OSMESA_LIB_NAME])
412 AC_SUBST([EGL_LIB_NAME])
413 AC_SUBST([GLESv1_CM_LIB_NAME])
414 AC_SUBST([GLESv2_LIB_NAME])
415 AC_SUBST([VG_LIB_NAME])
416 AC_SUBST([GLAPI_LIB_NAME])
418 AC_SUBST([GL_LIB_GLOB])
419 AC_SUBST([GLU_LIB_GLOB])
420 AC_SUBST([OSMESA_LIB_GLOB])
421 AC_SUBST([EGL_LIB_GLOB])
422 AC_SUBST([GLESv1_CM_LIB_GLOB])
423 AC_SUBST([GLESv2_LIB_GLOB])
424 AC_SUBST([VG_LIB_GLOB])
425 AC_SUBST([GLAPI_LIB_GLOB])
428 dnl Arch/platform-specific settings
431 [AS_HELP_STRING([--disable-asm],
432 [disable assembly usage @<:@default=enabled on supported plaforms@:>@])],
433 [enable_asm="$enableval"],
440 AC_MSG_CHECKING([whether to enable assembly])
441 test "x$enable_asm" = xno && AC_MSG_RESULT([no])
442 # disable if cross compiling on x86/x86_64 since we must run gen_matypes
443 if test "x$enable_asm" = xyes && test "x$cross_compiling" = xyes; then
447 AC_MSG_RESULT([no, cross compiling])
451 # check for supported arches
452 if test "x$enable_asm" = xyes; then
456 linux* | *freebsd* | dragonfly* | *netbsd*)
457 test "x$enable_64bit" = xyes && asm_arch=x86_64 || asm_arch=x86
463 linux* | *freebsd* | dragonfly* | *netbsd*)
464 test "x$enable_32bit" = xyes && asm_arch=x86 || asm_arch=x86_64
486 ASM_FLAGS="-DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM"
487 MESA_ASM_SOURCES='$(X86_SOURCES)'
488 GLAPI_ASM_SOURCES='$(X86_API)'
489 AC_MSG_RESULT([yes, x86])
492 ASM_FLAGS="-DUSE_X86_64_ASM"
493 MESA_ASM_SOURCES='$(X86-64_SOURCES)'
494 GLAPI_ASM_SOURCES='$(X86-64_API)'
495 AC_MSG_RESULT([yes, x86_64])
498 ASM_FLAGS="-DUSE_SPARC_ASM"
499 MESA_ASM_SOURCES='$(SPARC_SOURCES)'
500 GLAPI_ASM_SOURCES='$(SPARC_API)'
501 AC_MSG_RESULT([yes, sparc])
504 AC_MSG_RESULT([no, platform not supported])
508 AC_SUBST([ASM_FLAGS])
509 AC_SUBST([MESA_ASM_SOURCES])
510 AC_SUBST([GLAPI_ASM_SOURCES])
515 dnl Check to see if dlopen is in default libraries (like Solaris, which
516 dnl has it in libc), or if libdl is needed to get it.
517 AC_CHECK_FUNC([dlopen], [],
518 [AC_CHECK_LIB([dl], [dlopen], [DLOPEN_LIBS="-ldl"])])
519 AC_SUBST([DLOPEN_LIBS])
521 dnl See if posix_memalign is available
522 AC_CHECK_FUNC([posix_memalign], [DEFINES="$DEFINES -DHAVE_POSIX_MEMALIGN"])
524 dnl SELinux awareness.
525 AC_ARG_ENABLE([selinux],
526 [AS_HELP_STRING([--enable-selinux],
527 [Build SELinux-aware Mesa @<:@default=disabled@:>@])],
528 [MESA_SELINUX="$enableval"],
530 if test "x$enable_selinux" = "xyes"; then
531 AC_CHECK_HEADER([selinux/selinux.h],[],
532 [AC_MSG_ERROR([SELinux headers not found])])
533 AC_CHECK_LIB([selinux],[is_selinux_enabled],[],
534 [AC_MSG_ERROR([SELinux library not found])])
535 SELINUX_LIBS="-lselinux"
536 DEFINES="$DEFINES -DMESA_SELINUX"
540 AC_ARG_ENABLE([opengl],
541 [AS_HELP_STRING([--disable-opengl],
542 [disable support for standard OpenGL API @<:@default=no@:>@])],
543 [enable_opengl="$enableval"],
545 AC_ARG_ENABLE([gles1],
546 [AS_HELP_STRING([--enable-gles1],
547 [enable support for OpenGL ES 1.x API @<:@default=no@:>@])],
548 [enable_gles1="$enableval"],
550 AC_ARG_ENABLE([gles2],
551 [AS_HELP_STRING([--enable-gles2],
552 [enable support for OpenGL ES 2.x API @<:@default=no@:>@])],
553 [enable_gles2="$enableval"],
555 AC_ARG_ENABLE([openvg],
556 [AS_HELP_STRING([--enable-openvg],
557 [enable support for OpenVG API @<:@default=no@:>@])],
558 [enable_openvg="$enableval"],
562 [AS_HELP_STRING([--enable-dri],
563 [enable DRI modules @<:@default=auto@:>@])],
564 [enable_dri="$enableval"],
567 [AS_HELP_STRING([--enable-glx],
568 [enable GLX library @<:@default=auto@:>@])],
569 [enable_glx="$enableval"],
571 AC_ARG_ENABLE([osmesa],
572 [AS_HELP_STRING([--enable-osmesa],
573 [enable OSMesa library @<:@default=auto@:>@])],
574 [enable_osmesa="$enableval"],
575 [enable_osmesa=auto])
577 [AS_HELP_STRING([--disable-egl],
578 [disable EGL library @<:@default=enabled@:>@])],
579 [enable_egl="$enableval"],
582 AC_ARG_ENABLE([xorg],
583 [AS_HELP_STRING([--enable-xorg],
584 [enable support for X.Org DDX API @<:@default=no@:>@])],
585 [enable_xorg="$enableval"],
588 [AS_HELP_STRING([--enable-xa],
589 [enable build of the XA X Acceleration API @<:@default=no@:>@])],
590 [enable_xa="$enableval"],
592 AC_ARG_ENABLE([d3d1x],
593 [AS_HELP_STRING([--enable-d3d1x],
594 [enable support for Direct3D 10 & 11 low-level API @<:@default=no@:>@])],
595 [enable_d3d1x="$enableval"],
598 [AS_HELP_STRING([--enable-gbm],
599 [enable gbm library @<:@default=auto@:>@])],
600 [enable_gbm="$enableval"],
603 AC_ARG_ENABLE([xvmc],
604 [AS_HELP_STRING([--enable-xvmc],
605 [enable xvmc library @<:@default=auto@:>@])],
606 [enable_xvmc="$enableval"],
608 AC_ARG_ENABLE([vdpau],
609 [AS_HELP_STRING([--enable-vdpau],
610 [enable vdpau library @<:@default=auto@:>@])],
611 [enable_vdpau="$enableval"],
614 [AS_HELP_STRING([--enable-va],
615 [enable va library @<:@default=auto@:>@])],
616 [enable_va="$enableval"],
619 AC_ARG_ENABLE([xlib_glx],
620 [AS_HELP_STRING([--enable-xlib-glx],
621 [make GLX library Xlib-based instead of DRI-based @<:@default=disable@:>@])],
622 [enable_xlib_glx="$enableval"],
623 [enable_xlib_glx=auto])
624 AC_ARG_ENABLE([gallium_egl],
625 [AS_HELP_STRING([--enable-gallium-egl],
626 [enable optional EGL state tracker (not required
627 for EGL support in Gallium with OpenGL and OpenGL ES)
628 @<:@default=disable@:>@])],
629 [enable_gallium_egl="$enableval"],
630 [enable_gallium_egl=no])
631 AC_ARG_ENABLE([gallium_gbm],
632 [AS_HELP_STRING([--enable-gallium-gbm],
633 [enable optional gbm state tracker (not required for
634 gbm support in Gallium)
635 @<:@default=auto@:>@])],
636 [enable_gallium_gbm="$enableval"],
637 [enable_gallium_gbm=auto])
639 # Option for Gallium drivers
640 GALLIUM_DRIVERS_DEFAULT="r300,r600,svga,swrast"
642 AC_ARG_WITH([gallium-drivers],
643 [AS_HELP_STRING([--with-gallium-drivers@<:@=DIRS...@:>@],
644 [comma delimited Gallium drivers list, e.g.
645 "i915,nouveau,r300,r600,svga,swrast"
646 @<:@default=r300,r600,swrast@:>@])],
647 [with_gallium_drivers="$withval"],
648 [with_gallium_drivers="$GALLIUM_DRIVERS_DEFAULT"])
650 # Doing '--without-gallium-drivers' will set this variable to 'no'. Clear it
651 # here so that the script doesn't choke on an unknown driver name later.
652 case "$with_gallium_drivers" in
653 yes) with_gallium_drivers="$GALLIUM_DRIVERS_DEFAULT" ;;
654 no) with_gallium_drivers='' ;;
657 if test "x$enable_opengl" = xno -a \
658 "x$enable_gles1" = xno -a \
659 "x$enable_gles2" = xno -a \
660 "x$enable_openvg" = xno -a \
661 "x$enable_xorg" = xno -a \
662 "x$enable_xa" = xno -a \
663 "x$enable_d3d1x" = xno -a \
664 "x$enable_xvmc" = xno -a \
665 "x$enable_vdpau" = xno -a \
666 "x$enable_va" = xno; then
667 AC_MSG_ERROR([at least one API should be enabled])
671 if test "x$enable_opengl" = xno; then
672 API_DEFINES="$API_DEFINES -DFEATURE_GL=0"
674 API_DEFINES="$API_DEFINES -DFEATURE_GL=1"
676 if test "x$enable_gles1" = xyes; then
677 API_DEFINES="$API_DEFINES -DFEATURE_ES1=1"
679 if test "x$enable_gles2" = xyes; then
680 API_DEFINES="$API_DEFINES -DFEATURE_ES2=1"
682 AC_SUBST([API_DEFINES])
684 AC_ARG_ENABLE([shared-glapi],
685 [AS_HELP_STRING([--enable-shared-glapi],
686 [EXPERIMENTAL. Enable shared glapi for OpenGL @<:@default=no@:>@])],
687 [enable_shared_glapi="$enableval"],
688 [enable_shared_glapi=no])
691 if test "x$enable_shared_glapi" = xyes; then
693 # libGL will use libglapi for function lookups (IN_DRI_DRIVER means to use
695 DEFINES="$DEFINES -DIN_DRI_DRIVER"
696 SRC_DIRS="$SRC_DIRS mapi/shared-glapi"
698 AC_SUBST([SHARED_GLAPI])
699 AM_CONDITIONAL(HAVE_SHARED_GLAPI, test $SHARED_GLAPI = 1)
702 dnl Driver configuration. Options are xlib, dri and osmesa right now.
703 dnl More later: fbdev, ...
705 default_driver="xlib"
710 i*86|x86_64|powerpc*|sparc*) default_driver="dri";;
713 *freebsd* | dragonfly* | *netbsd*)
715 i*86|x86_64|powerpc*|sparc*) default_driver="dri";;
720 if test "x$enable_opengl" = xno; then
724 AC_ARG_WITH([driver],
725 [AS_HELP_STRING([--with-driver=DRIVER], [DEPRECATED])],
726 [mesa_driver="$withval"],
728 dnl Check for valid option
729 case "x$mesa_driver" in
730 xxlib|xdri|xosmesa|xno)
731 if test "x$enable_dri" != xauto -o \
732 "x$enable_glx" != xauto -o \
733 "x$enable_osmesa" != xauto -o \
734 "x$enable_xlib_glx" != xauto; then
735 AC_MSG_ERROR([--with-driver=$mesa_driver is deprecated])
739 mesa_driver="$default_driver"
742 AC_MSG_ERROR([Driver '$mesa_driver' is not a valid option])
746 # map $mesa_driver to APIs
747 if test "x$enable_dri" = xauto; then
748 case "x$mesa_driver" in
749 xdri) enable_dri=yes ;;
754 if test "x$enable_glx" = xauto; then
755 case "x$mesa_driver" in
756 xdri|xxlib) enable_glx=yes ;;
761 if test "x$enable_osmesa" = xauto; then
762 case "x$mesa_driver" in
763 xxlib|xosmesa) enable_osmesa=yes ;;
764 *) enable_osmesa=no ;;
768 if test "x$enable_xlib_glx" = xauto; then
769 case "x$mesa_driver" in
770 xxlib) enable_xlib_glx=yes ;;
771 *) enable_xlib_glx=no ;;
775 if test "x$enable_glx" = xno; then
779 AM_CONDITIONAL(HAVE_DRI, test x"$enable_dri" = xyes)
782 dnl Driver specific build directories
785 dnl this variable will be prepended to SRC_DIRS and is not exported
790 GALLIUM_DIRS="auxiliary drivers state_trackers"
791 GALLIUM_TARGET_DIRS=""
792 GALLIUM_WINSYS_DIRS="sw"
793 GALLIUM_DRIVERS_DIRS="galahad trace rbug noop identity"
794 GALLIUM_STATE_TRACKERS_DIRS=""
796 # build shared-glapi if enabled for OpenGL or if OpenGL ES is enabled
797 case "x$enable_shared_glapi$enable_gles1$enable_gles2" in
799 CORE_DIRS="$CORE_DIRS mapi/shared-glapi"
803 # build glapi if OpenGL is enabled
804 if test "x$enable_opengl" = xyes; then
805 CORE_DIRS="$CORE_DIRS mapi/glapi"
808 # build es1api if OpenGL ES 1.x is enabled
809 if test "x$enable_gles1" = xyes; then
810 CORE_DIRS="$CORE_DIRS mapi/es1api"
813 # build es2api if OpenGL ES 2.x is enabled
814 if test "x$enable_gles2" = xyes; then
815 CORE_DIRS="$CORE_DIRS mapi/es2api"
818 # build glsl and mesa if OpenGL or OpenGL ES is enabled
819 case "x$enable_opengl$enable_gles1$enable_gles2" in
821 CORE_DIRS="$CORE_DIRS glsl mesa"
825 case "x$enable_glx$enable_xlib_glx" in
827 DRIVER_DIRS="$DRIVER_DIRS x11"
828 GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS sw/xlib"
829 GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS libgl-xlib"
830 GALLIUM_STATE_TRACKERS_DIRS="glx $GALLIUM_STATE_TRACKERS_DIRS"
831 HAVE_WINSYS_XLIB="yes"
835 SRC_DIRS="$SRC_DIRS glx"
839 if test "x$enable_dri" = xyes; then
840 DRIVER_DIRS="$DRIVER_DIRS dri"
842 GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS sw/dri"
843 GALLIUM_STATE_TRACKERS_DIRS="dri $GALLIUM_STATE_TRACKERS_DIRS"
847 if test "x$enable_osmesa" = xyes; then
848 # the empty space matters for osmesa... (see src/mesa/Makefile)
849 if test -n "$DRIVER_DIRS"; then
850 DRIVER_DIRS="$DRIVER_DIRS osmesa"
858 AC_SUBST([DRIVER_DIRS])
859 AC_SUBST([GALLIUM_DIRS])
860 AC_SUBST([GALLIUM_TARGET_DIRS])
861 AC_SUBST([GALLIUM_WINSYS_DIRS])
862 AC_SUBST([GALLIUM_DRIVERS_DIRS])
863 AC_SUBST([GALLIUM_STATE_TRACKERS_DIRS])
864 AC_SUBST([MESA_LLVM])
867 PKG_CHECK_MODULES([LIBDRM], [libdrm >= $LIBDRM_REQUIRED],
868 [have_libdrm=yes], [have_libdrm=no])
870 if test "x$enable_dri" = xyes; then
871 # DRI must be shared, I think
872 if test "$enable_static" = yes; then
873 AC_MSG_ERROR([Can't use static libraries for DRI drivers])
876 # not a hard requirement as swrast does not depend on it
877 if test "x$have_libdrm" = xyes; then
878 DRI_PC_REQ_PRIV="libdrm >= $LIBDRM_REQUIRED"
883 dnl Find out if X is available. The variable have_x is set if libX11 is
884 dnl found to mimic AC_PATH_XTRA.
886 if test -n "$PKG_CONFIG"; then
887 AC_MSG_CHECKING([pkg-config files for X11 are available])
888 PKG_CHECK_EXISTS([x11],[
894 AC_MSG_RESULT([$x11_pkgconfig])
898 dnl Use the autoconf macro if no pkg-config files
899 if test "$x11_pkgconfig" = yes; then
900 PKG_CHECK_MODULES([X11], [x11])
903 test -z "$X11_CFLAGS" && X11_CFLAGS="$X_CFLAGS"
904 test -z "$X11_LIBS" && X11_LIBS="$X_LIBS -lX11"
905 AC_SUBST([X11_CFLAGS])
909 dnl Try to tell the user that the --x-* options are only used when
910 dnl pkg-config is not available. This must be right after AC_PATH_XTRA.
911 m4_divert_once([HELP_BEGIN],
912 [These options are only used when the X libraries cannot be found by the
913 pkg-config utility.])
915 dnl We need X for xlib and dri, so bomb now if it's not found
916 if test "x$enable_glx" = xyes -a "x$no_x" = xyes; then
917 AC_MSG_ERROR([X11 development libraries needed for GLX])
920 if test "x$enable_glx" = xyes; then
921 DEFINES="$DEFINES -DUSE_XCB"
924 dnl Direct rendering or just indirect rendering
927 dnl Disable by default on GNU/Hurd
928 driglx_direct_default="no"
931 dnl Disable by default on cygwin
932 driglx_direct_default="no"
935 driglx_direct_default="yes"
938 AC_ARG_ENABLE([driglx-direct],
939 [AS_HELP_STRING([--disable-driglx-direct],
940 [enable direct rendering in GLX and EGL for DRI \
941 @<:@default=auto@:>@])],
942 [driglx_direct="$enableval"],
943 [driglx_direct="$driglx_direct_default"])
946 dnl libGL configuration per driver
948 case "x$enable_glx$enable_xlib_glx" in
951 if test "$x11_pkgconfig" = yes; then
952 PKG_CHECK_MODULES([XLIBGL], [x11 xext])
953 GL_PC_REQ_PRIV="x11 xext"
954 X11_INCLUDES="$X11_INCLUDES $XLIBGL_CFLAGS"
955 GL_LIB_DEPS="$XLIBGL_LIBS"
957 # should check these...
958 X11_INCLUDES="$X11_INCLUDES $X_CFLAGS"
959 GL_LIB_DEPS="$X_LIBS -lX11 -lXext"
960 GL_PC_LIB_PRIV="$GL_LIB_DEPS"
961 GL_PC_CFLAGS="$X11_INCLUDES"
963 GL_LIB_DEPS="$GL_LIB_DEPS $SELINUX_LIBS -lm -lpthread $DLOPEN_LIBS"
964 GL_PC_LIB_PRIV="$GL_PC_LIB_PRIV $SELINUX_LIBS -lm -lpthread"
968 PKG_CHECK_MODULES([GLPROTO], [glproto >= $GLPROTO_REQUIRED])
969 GL_PC_REQ_PRIV="glproto >= $GLPROTO_REQUIRED"
970 if test x"$driglx_direct" = xyes; then
971 if test "x$have_libdrm" != xyes; then
972 AC_MSG_ERROR([Direct rendering requires libdrm >= $LIBDRM_REQUIRED])
974 PKG_CHECK_MODULES([DRI2PROTO], [dri2proto >= $DRI2PROTO_REQUIRED])
975 GL_PC_REQ_PRIV="$GL_PC_REQ_PRIV libdrm >= $LIBDRM_REQUIRED dri2proto >= $DRI2PROTO_REQUIRED"
978 # find the DRI deps for libGL
979 if test "$x11_pkgconfig" = yes; then
980 dri_modules="x11 xext xdamage xfixes x11-xcb xcb-glx"
982 # add xf86vidmode if available
983 PKG_CHECK_MODULES([XF86VIDMODE], [xxf86vm], HAVE_XF86VIDMODE=yes, HAVE_XF86VIDMODE=no)
984 if test "$HAVE_XF86VIDMODE" = yes ; then
985 dri_modules="$dri_modules xxf86vm"
988 PKG_CHECK_MODULES([DRIGL], [$dri_modules])
989 GL_PC_REQ_PRIV="$GL_PC_REQ_PRIV $dri_modules"
990 X11_INCLUDES="$X11_INCLUDES $DRIGL_CFLAGS"
991 GL_LIB_DEPS="$DRIGL_LIBS"
993 # should check these...
994 X11_INCLUDES="$X11_INCLUDES $X_CFLAGS"
995 if test "x$HAVE_XF86VIDMODE" == xyes; then
996 GL_LIB_DEPS="$X_LIBS -lX11 -lXext -lXxf86vm -lXdamage -lXfixes"
998 GL_LIB_DEPS="$X_LIBS -lX11 -lXext -lXdamage -lXfixes"
1000 GL_PC_LIB_PRIV="$GL_LIB_DEPS"
1001 GL_PC_CFLAGS="$X11_INCLUDES"
1003 # XCB can only be used from pkg-config
1004 PKG_CHECK_MODULES([XCB],[x11-xcb xcb-glx])
1005 GL_PC_REQ_PRIV="$GL_PC_REQ_PRIV x11-xcb xcb-glx"
1006 X11_INCLUDES="$X11_INCLUDES $XCB_CFLAGS"
1007 GL_LIB_DEPS="$GL_LIB_DEPS $XCB_LIBS"
1010 # Check to see if the xcb-glx library is new enough to support
1011 # GLX_ARB_create_context. This bit of hackery is necessary until XCB 1.8
1013 save_CPPFLAGS="$CPPFLAGS"
1014 save_LDFLAGS="$LDFLAGS"
1015 CPPFLAGS="$CPPFLAGS $X11_INCLUDES"
1016 LDFLAGS="$LDFLAGS $GL_LIB_DEPS"
1017 AC_CHECK_LIB(xcb-glx, xcb_glx_create_context_attribs_arb_checked,
1018 [HAVE_XCB_GLX_CREATE_CONTEXT=yes],
1019 [HAVE_XCB_GLX_CREATE_CONTEXT=no])
1020 CPPFLAGS="$save_CPPFLAGS"
1021 LDFLAGS="$save_LDFLAGS"
1023 if test x$HAVE_XCB_GLX_CREATE_CONTEXT = xyes; then
1024 X11_INCLUDES="$X11_INCLUDES -DHAVE_XCB_GLX_CREATE_CONTEXT"
1027 # need DRM libs, -lpthread, etc.
1028 GL_LIB_DEPS="$GL_LIB_DEPS $LIBDRM_LIBS -lm -lpthread $DLOPEN_LIBS"
1029 GL_PC_LIB_PRIV="-lm -lpthread $DLOPEN_LIBS"
1033 # This is outside the case (above) so that it is invoked even for non-GLX
1035 AM_CONDITIONAL(HAVE_XCB_GLX_CREATE_CONTEXT,
1036 test x$HAVE_XCB_GLX_CREATE_CONTEXT = xyes)
1037 AM_CONDITIONAL(HAVE_XF86VIDMODE, test "x$HAVE_XF86VIDMODE" = xyes)
1039 GLESv1_CM_LIB_DEPS="$LIBDRM_LIBS -lm -lpthread $DLOPEN_LIBS"
1040 GLESv1_CM_PC_LIB_PRIV="-lm -lpthread $DLOPEN_LIBS"
1041 GLESv2_LIB_DEPS="$LIBDRM_LIBS -lm -lpthread $DLOPEN_LIBS"
1042 GLESv2_PC_LIB_PRIV="-lm -lpthread $DLOPEN_LIBS"
1044 AC_SUBST([GL_LIB_DEPS])
1045 AC_SUBST([GL_PC_REQ_PRIV])
1046 AC_SUBST([GL_PC_LIB_PRIV])
1047 AC_SUBST([GL_PC_CFLAGS])
1048 AC_SUBST([DRI_PC_REQ_PRIV])
1049 AC_SUBST([GLESv1_CM_LIB_DEPS])
1050 AC_SUBST([GLESv1_CM_PC_LIB_PRIV])
1051 AC_SUBST([GLESv2_LIB_DEPS])
1052 AC_SUBST([GLESv2_PC_LIB_PRIV])
1054 GLAPI_LIB_DEPS="-lpthread $SELINUX_LIBS"
1055 AC_SUBST([GLAPI_LIB_DEPS])
1058 dnl Setup default DRI CFLAGS
1059 DRI_CFLAGS='$(CFLAGS)'
1060 DRI_CXXFLAGS='$(CXXFLAGS)'
1061 DRI_LIB_DEPS='$(TOP)/src/mesa/libmesa.a'
1062 MESA_MODULES='$(TOP)/src/mesa/libmesa.a'
1064 if test "x$enable_dri" = xyes && test "x$driglx_direct" = xyes ; then
1065 DRICORE_GLSL_LIBS='$(TOP)/$(LIB_DIR)/libglsl.so'
1066 DRICORE_LIBS='$(TOP)/$(LIB_DIR)/libdricore.so'
1067 DRICORE_LIB_DEPS='-L$(TOP)/$(LIB_DIR) -Wl,-R$(DRI_DRIVER_INSTALL_DIR) -lglsl'
1068 DRI_LIB_DEPS='-L$(TOP)/$(LIB_DIR) -Wl,-R$(DRI_DRIVER_INSTALL_DIR) -ldricore -lglsl'
1069 DRI_CFLAGS='$(CFLAGS_NOVISIBILITY) -DUSE_DRICORE'
1070 DRI_CXXFLAGS='$(CXXFLAGS_NOVISIBILITY) -DUSE_DRICORE'
1071 MESA_MODULES='$(DRICORE_LIBS) $(DRICORE_GLSL_LIBS)'
1073 AC_SUBST([DRICORE_LIBS])
1074 AC_SUBST([DRICORE_GLSL_LIBS])
1075 AC_SUBST([DRICORE_LIB_DEPS])
1076 AC_SUBST([DRI_CXXFLAGS])
1077 AC_SUBST([DRI_CFLAGS])
1078 AC_SUBST([MESA_MODULES])
1080 AC_SUBST([HAVE_XF86VIDMODE])
1085 case "x$enable_glx$enable_xlib_glx" in
1087 DEFINES="$DEFINES -DUSE_XSHM"
1090 DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING"
1091 if test "x$driglx_direct" = xyes; then
1092 DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
1101 AC_ARG_ENABLE([glx-tls],
1102 [AS_HELP_STRING([--enable-glx-tls],
1103 [enable TLS support in GLX @<:@default=disabled@:>@])],
1104 [GLX_USE_TLS="$enableval"],
1106 AC_SUBST(GLX_TLS, ${GLX_USE_TLS})
1108 AS_IF([test "x$GLX_USE_TLS" = xyes],
1109 [DEFINES="${DEFINES} -DGLX_USE_TLS -DPTHREADS"])
1114 dnl Directory for DRI drivers
1115 AC_ARG_WITH([dri-driverdir],
1116 [AS_HELP_STRING([--with-dri-driverdir=DIR],
1117 [directory for the DRI drivers @<:@${libdir}/dri@:>@])],
1118 [DRI_DRIVER_INSTALL_DIR="$withval"],
1119 [DRI_DRIVER_INSTALL_DIR='${libdir}/dri'])
1120 AC_SUBST([DRI_DRIVER_INSTALL_DIR])
1121 dnl Extra search path for DRI drivers
1122 AC_ARG_WITH([dri-searchpath],
1123 [AS_HELP_STRING([--with-dri-searchpath=DIRS...],
1124 [semicolon delimited DRI driver search directories @<:@${libdir}/dri@:>@])],
1125 [DRI_DRIVER_SEARCH_DIR="$withval"],
1126 [DRI_DRIVER_SEARCH_DIR='${DRI_DRIVER_INSTALL_DIR}'])
1127 AC_SUBST([DRI_DRIVER_SEARCH_DIR])
1128 dnl Which drivers to build - default is chosen by platform
1129 AC_ARG_WITH([dri-drivers],
1130 [AS_HELP_STRING([--with-dri-drivers@<:@=DIRS...@:>@],
1131 [comma delimited DRI drivers list, e.g.
1132 "swrast,i965,radeon" @<:@default=auto@:>@])],
1133 [with_dri_drivers="$withval"],
1134 [with_dri_drivers=yes])
1135 if test "x$with_dri_drivers" = x; then
1139 dnl If $with_dri_drivers is yes, directories will be added through
1142 case "$with_dri_drivers" in
1145 # classic DRI drivers require FEATURE_GL to build
1146 if test "x$enable_opengl" = xyes; then
1151 # verify the requested driver directories exist
1152 dri_drivers=`IFS=', '; echo $with_dri_drivers`
1153 for driver in $dri_drivers; do
1154 test -d "$srcdir/src/mesa/drivers/dri/$driver" || \
1155 AC_MSG_ERROR([DRI driver directory '$driver' doesn't exist])
1157 DRI_DIRS="$dri_drivers"
1158 if test -n "$DRI_DIRS" -a "x$enable_opengl" != xyes; then
1159 AC_MSG_ERROR([--with-dri-drivers requires OpenGL])
1164 dnl Set DRI_DIRS, DEFINES and LIB_DEPS
1165 if test "x$enable_dri" = xyes; then
1166 # Platform specific settings and drivers to build
1169 DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
1170 DEFINES="$DEFINES -DHAVE_ALIAS"
1174 if test "x$DRI_DIRS" = "xyes"; then
1175 DRI_DIRS="i915 i965 nouveau r200 radeon swrast"
1179 # Build only the drivers for cards that exist on PowerPC.
1180 if test "x$DRI_DIRS" = "xyes"; then
1181 DRI_DIRS="r200 radeon swrast"
1185 # Build only the drivers for cards that exist on sparc
1186 if test "x$DRI_DIRS" = "xyes"; then
1187 DRI_DIRS="r200 radeon swrast"
1192 freebsd* | dragonfly* | *netbsd*)
1193 DEFINES="$DEFINES -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1"
1194 DEFINES="$DEFINES -DIN_DRI_DRIVER -DHAVE_ALIAS"
1196 if test "x$DRI_DIRS" = "xyes"; then
1197 DRI_DIRS="i915 i965 nouveau r200 radeon swrast"
1201 DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
1202 DEFINES="$DEFINES -DHAVE_ALIAS"
1205 DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
1208 DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
1209 if test "x$DRI_DIRS" = "xyes"; then
1216 if test "x$DRI_DIRS" = "xyes"; then
1217 DRI_DIRS="i915 i965 nouveau r200 radeon swrast"
1220 DRI_DIRS=`echo "$DRI_DIRS" | $SED 's/ */ /g'`
1223 if test "x$enable_dri" = xyes; then
1226 AC_ARG_WITH([expat],
1227 [AS_HELP_STRING([--with-expat=DIR],
1228 [expat install directory])],[
1229 EXPAT_INCLUDES="-I$withval/include"
1230 CPPFLAGS="$CPPFLAGS $EXPAT_INCLUDES"
1231 LDFLAGS="$LDFLAGS -L$withval/$LIB_DIR"
1232 EXPAT_LIB="-L$withval/$LIB_DIR -lexpat"
1234 AC_CHECK_HEADER([expat.h],[],[AC_MSG_ERROR([Expat required for DRI.])])
1236 AC_CHECK_LIB([expat],[XML_ParserCreate],[],
1237 [AC_MSG_ERROR([Expat required for DRI.])])
1241 # if we are building any dri driver other than swrast ...
1242 if test -n "$DRI_DIRS" -a x"$DRI_DIRS" != xswrast; then
1243 # ... libdrm is required
1244 if test "x$have_libdrm" != xyes; then
1245 AC_MSG_ERROR([DRI drivers requires libdrm >= $LIBDRM_REQUIRED])
1247 # ... and build dricommon
1251 # put all the necessary libs together
1252 DRI_LIB_DEPS="$DRI_LIB_DEPS $SELINUX_LIBS $LIBDRM_LIBS $EXPAT_LIB -lm -lpthread $DLOPEN_LIBS"
1254 AC_SUBST([DRI_DIRS])
1255 AC_SUBST([EXPAT_INCLUDES])
1256 AC_SUBST([DRI_LIB_DEPS])
1260 PKG_CHECK_MODULES([INTEL], [libdrm_intel >= $LIBDRM_INTEL_REQUIRED])
1262 for d in $(echo $DRI_DIRS | sed 's/,/ /g'); do
1278 PKG_CHECK_MODULES([NOUVEAU], [libdrm_nouveau >= $LIBDRM_NVVIEUX_REQUIRED])
1279 HAVE_NOUVEAU_DRI=yes;
1285 PKG_CHECK_MODULES([RADEON], [libdrm_radeon >= $LIBDRM_RADEON_REQUIRED])
1287 for d in $(echo $DRI_DIRS | sed 's/,/ /g'); do
1290 HAVE_RADEON_DRI=yes;
1303 HAVE_SWRAST_DRI=yes;
1307 AM_CONDITIONAL(HAVE_I915_DRI, test x$HAVE_I915_DRI = xyes)
1308 AM_CONDITIONAL(HAVE_I965_DRI, test x$HAVE_I965_DRI = xyes)
1309 AM_CONDITIONAL(HAVE_NOUVEAU_DRI, test x$HAVE_NOUVEAU_DRI = xyes)
1310 AM_CONDITIONAL(HAVE_R200_DRI, test x$HAVE_R200_DRI = xyes)
1311 AM_CONDITIONAL(HAVE_RADEON_DRI, test x$HAVE_RADEON_DRI = xyes)
1312 AM_CONDITIONAL(HAVE_SWRAST_DRI, test x$HAVE_SWRAST_DRI = xyes)
1313 AM_CONDITIONAL(HAVE_COMMON_DRI, test x$HAVE_COMMON_DRI = xyes)
1316 dnl OSMesa configuration
1319 dnl Configure the channel bits for OSMesa (libOSMesa, libOSMesa16, ...)
1320 AC_ARG_WITH([osmesa-bits],
1321 [AS_HELP_STRING([--with-osmesa-bits=BITS],
1322 [OSMesa channel bits and library name: 8, 16, 32 @<:@default=8@:>@])],
1323 [osmesa_bits="$withval"],
1325 if test "x$osmesa_bits" != x8; then
1326 if test "x$enable_dri" = xyes -o "x$enable_glx" = xyes; then
1327 AC_MSG_WARN([Ignoring OSMesa channel bits because of non-OSMesa driver])
1331 case "x$osmesa_bits" in
1333 OSMESA_LIB="${OSMESA_LIB}"
1336 OSMESA_LIB="${OSMESA_LIB}$osmesa_bits"
1337 DEFINES="$DEFINES -DCHAN_BITS=$osmesa_bits -DDEFAULT_SOFTWARE_DEPTH_BITS=31"
1340 AC_MSG_ERROR([OSMesa bits '$osmesa_bits' is not a valid option])
1344 if test "x$enable_osmesa" = xyes; then
1345 # only link libraries with osmesa if shared
1346 if test "$enable_static" = no; then
1347 OSMESA_LIB_DEPS="-lm -lpthread $SELINUX_LIBS $DLOPEN_LIBS"
1352 OSMESA_PC_LIB_PRIV="-lm -lpthread $SELINUX_LIBS $DLOPEN_LIBS"
1354 AC_SUBST([OSMESA_LIB_DEPS])
1355 AC_SUBST([OSMESA_MESA_DEPS])
1356 AC_SUBST([OSMESA_PC_REQ])
1357 AC_SUBST([OSMESA_PC_LIB_PRIV])
1360 dnl gbm configuration
1362 if test "x$enable_gbm" = xauto; then
1363 case "$with_egl_platforms" in
1370 if test "x$enable_gbm" = xyes; then
1371 SRC_DIRS="$SRC_DIRS gbm"
1373 PKG_CHECK_MODULES([LIBUDEV], [libudev], [],
1374 AC_MSG_ERROR([gbm needs udev]))
1376 if test "x$enable_dri" = xyes; then
1377 GBM_BACKEND_DIRS="$GBM_BACKEND_DIRS dri"
1378 if test "$SHARED_GLAPI" -eq 0; then
1379 AC_MSG_ERROR([gbm_dri requires --enable-shared-glapi])
1383 GBM_PC_REQ_PRIV="libudev"
1384 GBM_PC_LIB_PRIV="$DLOPEN_LIBS"
1385 AC_SUBST([GBM_PC_REQ_PRIV])
1386 AC_SUBST([GBM_PC_LIB_PRIV])
1389 dnl EGL configuration
1393 if test "x$enable_egl" = xyes; then
1394 SRC_DIRS="$SRC_DIRS egl"
1395 EGL_LIB_DEPS="$DLOPEN_LIBS $SELINUX_LIBS -lpthread"
1397 AC_CHECK_FUNC(mincore, [DEFINES="$DEFINES -DHAVE_MINCORE"])
1399 if test "$enable_static" != yes; then
1400 # build egl_glx when libGL is built
1401 if test "x$enable_glx" = xyes; then
1402 HAVE_EGL_DRIVER_GLX=1
1405 PKG_CHECK_MODULES([LIBUDEV], [libudev > 150],
1406 [have_libudev=yes],[have_libudev=no])
1407 if test "$have_libudev" = yes; then
1408 DEFINES="$DEFINES -DHAVE_LIBUDEV"
1410 if test "x$enable_dri" = xyes; then
1411 # build egl_dri2 when xcb-dri2 is available
1412 PKG_CHECK_MODULES([XCB_DRI2], [x11-xcb xcb-dri2 xcb-xfixes],
1413 [have_xcb_dri2=yes],[have_xcb_dri2=no])
1414 if test "$have_xcb_dri2" = yes; then
1415 HAVE_EGL_DRIVER_DRI2=1
1416 # workaround a bug in xcb-dri2 generated by xcb-proto 1.6
1418 AC_CHECK_LIB(xcb-dri2, xcb_dri2_connect_alignment_pad, [],
1419 [DEFINES="$DEFINES -DXCB_DRI2_CONNECT_DEVICE_NAME_BROKEN"])
1426 AC_SUBST([EGL_LIB_DEPS])
1429 dnl EGL Gallium configuration
1431 if test "x$enable_gallium_egl" = xyes; then
1432 if test "x$with_gallium_drivers" = x; then
1433 AC_MSG_ERROR([cannot enable egl_gallium without Gallium])
1435 if test "x$enable_egl" = xno; then
1436 AC_MSG_ERROR([cannot enable egl_gallium without EGL])
1438 if test "x$have_libdrm" != xyes; then
1439 AC_MSG_ERROR([egl_gallium requires libdrm >= $LIBDRM_REQUIRED])
1442 GALLIUM_STATE_TRACKERS_DIRS="egl $GALLIUM_STATE_TRACKERS_DIRS"
1443 GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS egl-static"
1448 dnl gbm Gallium configuration
1450 if test "x$enable_gallium_gbm" = xauto; then
1451 case "$enable_gbm$HAVE_ST_EGL$enable_dri$with_egl_platforms" in
1453 enable_gallium_gbm=yes ;;
1455 enable_gallium_gbm=no ;;
1458 if test "x$enable_gallium_gbm" = xyes; then
1459 if test "x$with_gallium_drivers" = x; then
1460 AC_MSG_ERROR([cannot enable gbm_gallium without Gallium])
1462 if test "x$enable_gbm" = xno; then
1463 AC_MSG_ERROR([cannot enable gbm_gallium without gbm])
1465 # gbm_gallium abuses DRI_LIB_DEPS to link. Make sure it is set.
1466 if test "x$enable_dri" = xno; then
1467 AC_MSG_ERROR([gbm_gallium requires --enable-dri to build])
1470 GALLIUM_STATE_TRACKERS_DIRS="gbm $GALLIUM_STATE_TRACKERS_DIRS"
1471 GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS gbm"
1476 dnl X.Org DDX configuration
1478 if test "x$enable_xorg" = xyes; then
1479 PKG_CHECK_MODULES([XORG], [xorg-server >= 1.6.0])
1480 PKG_CHECK_MODULES([LIBDRM_XORG], [libdrm >= $LIBDRM_XORG_REQUIRED])
1481 PKG_CHECK_MODULES([LIBKMS_XORG], [libkms >= $LIBKMS_XORG_REQUIRED])
1482 PKG_CHECK_MODULES(XEXT, [xextproto >= 7.0.99.1],
1483 HAVE_XEXTPROTO_71="yes"; DEFINES="$DEFINES -DHAVE_XEXTPROTO_71",
1484 HAVE_XEXTPROTO_71="no")
1485 GALLIUM_STATE_TRACKERS_DIRS="xorg $GALLIUM_STATE_TRACKERS_DIRS"
1490 dnl XA configuration
1492 if test "x$enable_xa" = xyes; then
1495 AC_CHECK_PROG(NM, nm, "nm")
1496 if test "x$AWK" = x || test "x$GREP" = x || test "x$NM" = x; then
1497 AC_MSG_WARN([Missing one of nm, grep or awk. Disabling xa.])
1501 if test "x$enable_xa" = xyes; then
1502 GALLIUM_STATE_TRACKERS_DIRS="xa $GALLIUM_STATE_TRACKERS_DIRS"
1510 dnl OpenVG configuration
1514 if test "x$enable_openvg" = xyes; then
1515 if test "x$enable_egl" = xno; then
1516 AC_MSG_ERROR([cannot enable OpenVG without EGL])
1518 if test "x$with_gallium_drivers" = x; then
1519 AC_MSG_ERROR([cannot enable OpenVG without Gallium])
1521 if test "x$enable_gallium_egl" = xno; then
1522 AC_MSG_ERROR([cannot enable OpenVG without egl_gallium])
1525 EGL_CLIENT_APIS="$EGL_CLIENT_APIS "'$(VG_LIB)'
1526 VG_LIB_DEPS="$VG_LIB_DEPS $SELINUX_LIBS -lpthread"
1527 CORE_DIRS="$CORE_DIRS mapi/vgapi"
1528 GALLIUM_STATE_TRACKERS_DIRS="vega $GALLIUM_STATE_TRACKERS_DIRS"
1533 dnl D3D1X configuration
1536 if test "x$enable_d3d1x" = xyes; then
1537 if test "x$with_gallium_drivers" = x; then
1538 AC_MSG_ERROR([cannot enable D3D1X without Gallium])
1541 GALLIUM_STATE_TRACKERS_DIRS="d3d1x $GALLIUM_STATE_TRACKERS_DIRS"
1546 dnl Gallium G3DVL configuration
1548 AC_ARG_ENABLE([gallium-g3dvl],
1549 [AS_HELP_STRING([--enable-gallium-g3dvl],
1550 [build gallium g3dvl @<:@default=disabled@:>@])],
1551 [enable_gallium_g3dvl="$enableval"],
1552 [enable_gallium_g3dvl=no])
1553 if test "x$enable_gallium_g3dvl" = xyes; then
1554 if test "x$with_gallium_drivers" = x; then
1555 AC_MSG_ERROR([cannot enable G3DVL without Gallium])
1558 if test "x$enable_xvmc" = xauto; then
1559 PKG_CHECK_EXISTS([xvmc], [enable_xvmc=yes], [enable_xvmc=no])
1562 if test "x$enable_vdpau" = xauto; then
1563 PKG_CHECK_EXISTS([vdpau], [enable_vdpau=yes], [enable_vdpau=no])
1566 if test "x$enable_va" = xauto; then
1567 #don't enable vaapi state tracker even if package exists
1568 #PKG_CHECK_EXISTS([libva], [enable_vdpau=yes], [enable_vdpau=no])
1573 if test "x$enable_xvmc" = xyes; then
1574 PKG_CHECK_MODULES([XVMC], [xvmc >= 1.0.6 x11-xcb xcb-dri2 >= 1.8])
1575 GALLIUM_STATE_TRACKERS_DIRS="$GALLIUM_STATE_TRACKERS_DIRS xvmc"
1579 if test "x$enable_vdpau" = xyes; then
1580 PKG_CHECK_MODULES([VDPAU], [vdpau >= 0.4.1 x11-xcb xcb-dri2 >= 1.8])
1581 GALLIUM_STATE_TRACKERS_DIRS="$GALLIUM_STATE_TRACKERS_DIRS vdpau"
1585 if test "x$enable_va" = xyes; then
1586 PKG_CHECK_MODULES([LIBVA], [libva = 0.31.1 x11-xcb xcb-dri2 >= 1.8])
1587 AC_MSG_WARN([vaapi state tracker currently unmaintained])
1588 GALLIUM_STATE_TRACKERS_DIRS="$GALLIUM_STATE_TRACKERS_DIRS va"
1593 dnl GLU configuration
1595 AC_ARG_ENABLE([glu],
1596 [AS_HELP_STRING([--disable-glu],
1597 [enable OpenGL Utility library @<:@default=enabled@:>@])],
1598 [enable_glu="$enableval"],
1601 if test "x$enable_glu" = xyes; then
1602 if test "x$enable_glx" = xno -a "x$enable_osmesa" = xno; then
1603 AC_MSG_NOTICE([Disabling GLU since there is no OpenGL driver])
1608 if test "x$enable_glu" = xyes; then
1609 SRC_DIRS="$SRC_DIRS glu"
1611 if test "x$enable_glx" = xno; then
1612 # Link libGLU to libOSMesa instead of libGL
1615 if test "$enable_static" = no; then
1616 GLU_MESA_DEPS='-l$(OSMESA_LIB)'
1621 # If static, empty GLU_LIB_DEPS and add libs for programs to link
1623 GLU_PC_LIB_PRIV="-lm"
1624 if test "$enable_static" = no; then
1626 GLU_MESA_DEPS='-l$(GL_LIB)'
1633 if test "$enable_static" = no; then
1634 GLU_LIB_DEPS="$GLU_LIB_DEPS $OS_CPLUSPLUS_LIBS"
1636 GLU_PC_LIB_PRIV="$GLU_PC_LIB_PRIV $OS_CPLUSPLUS_LIBS"
1637 AC_SUBST([GLU_LIB_DEPS])
1638 AC_SUBST([GLU_MESA_DEPS])
1639 AC_SUBST([GLU_PC_REQ])
1640 AC_SUBST([GLU_PC_REQ_PRIV])
1641 AC_SUBST([GLU_PC_LIB_PRIV])
1642 AC_SUBST([GLU_PC_CFLAGS])
1644 AC_SUBST([PROGRAM_DIRS])
1647 dnl Gallium configuration
1649 if test "x$with_gallium_drivers" != x; then
1650 SRC_DIRS="$SRC_DIRS gallium gallium/winsys gallium/targets"
1653 AC_SUBST([LLVM_BINDIR])
1654 AC_SUBST([LLVM_CFLAGS])
1655 AC_SUBST([LLVM_CXXFLAGS])
1656 AC_SUBST([LLVM_LIBS])
1657 AC_SUBST([LLVM_LDFLAGS])
1658 AC_SUBST([LLVM_INCLUDEDIR])
1659 AC_SUBST([LLVM_VERSION])
1661 case "x$enable_opengl$enable_gles1$enable_gles2" in
1663 EGL_CLIENT_APIS="$EGL_CLIENT_APIS "'$(GL_LIB)'
1667 AC_SUBST([VG_LIB_DEPS])
1668 AC_SUBST([EGL_CLIENT_APIS])
1670 AC_ARG_WITH([egl-platforms],
1671 [AS_HELP_STRING([--with-egl-platforms@<:@=DIRS...@:>@],
1672 [comma delimited native platforms libEGL supports, e.g.
1673 "x11,drm" @<:@default=auto@:>@])],
1674 [with_egl_platforms="$withval"],
1675 [if test "x$enable_egl" = xyes; then
1676 with_egl_platforms="x11"
1678 with_egl_platforms=""
1683 if test "x$with_egl_platforms" != "x" -a "x$enable_egl" != xyes; then
1684 AC_MSG_ERROR([cannot build egl state tracker without EGL library])
1687 # verify the requested driver directories exist
1688 egl_platforms=`IFS=', '; echo $with_egl_platforms`
1689 for plat in $egl_platforms; do
1690 test -d "$srcdir/src/gallium/state_trackers/egl/$plat" || \
1691 AC_MSG_ERROR([EGL platform '$plat' does not exist])
1692 if test "$plat" = "fbdev"; then
1693 GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS sw/fbdev"
1695 if test "$plat" = "null"; then
1696 GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS sw/null"
1698 if test "$plat" = "wayland"; then
1699 PKG_CHECK_MODULES([WAYLAND], [wayland-client wayland-server],, \
1700 [AC_MSG_ERROR([cannot find libwayland-client])])
1701 GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS sw/wayland"
1703 m4_ifdef([WAYLAND_SCANNER_RULES],
1704 [WAYLAND_SCANNER_RULES(['$(top_srcdir)/src/egl/wayland/wayland-drm/protocol'])])
1706 if test "$plat" = "drm" && test "x$enable_gbm" = "xno"; then
1707 AC_MSG_ERROR([EGL platform drm needs gbm])
1709 case "$plat$have_libudev" in
1711 AC_MSG_ERROR([cannot build $plat platfrom without udev]) ;;
1715 # libEGL wants to default to the first platform specified in
1716 # ./configure. parse that here.
1717 if test "x$egl_platforms" != "x"; then
1718 FIRST_PLATFORM_CAPS=`echo $egl_platforms | sed 's| .*||' | tr 'a-z' 'A-Z'`
1719 EGL_NATIVE_PLATFORM="_EGL_PLATFORM_$FIRST_PLATFORM_CAPS"
1721 EGL_NATIVE_PLATFORM="_EGL_INVALID_PLATFORM"
1724 EGL_PLATFORMS="$egl_platforms"
1726 AM_CONDITIONAL(HAVE_EGL_PLATFORM_X11, echo "$egl_platforms" | grep 'x11' >/dev/null 2>&1)
1727 AM_CONDITIONAL(HAVE_EGL_PLATFORM_WAYLAND, echo "$egl_platforms" | grep 'wayland' >/dev/null 2>&1)
1728 AM_CONDITIONAL(HAVE_EGL_PLATFORM_DRM, echo "$egl_platforms" | grep 'drm' >/dev/null 2>&1)
1729 AM_CONDITIONAL(HAVE_EGL_PLATFORM_FBDEV, echo "$egl_platforms" | grep 'fbdev' >/dev/null 2>&1)
1730 AM_CONDITIONAL(HAVE_EGL_PLATFORM_NULL, echo "$egl_platforms" | grep 'null' >/dev/null 2>&1)
1732 AM_CONDITIONAL(HAVE_EGL_DRIVER_DRI2, test "x$HAVE_EGL_DRIVER_DRI2" != "x")
1733 AM_CONDITIONAL(HAVE_EGL_DRIVER_GLX, test "x$HAVE_EGL_DRIVER_GLX" != "x")
1735 AC_SUBST([EGL_NATIVE_PLATFORM])
1736 AC_SUBST([EGL_PLATFORMS])
1737 AC_SUBST([EGL_CFLAGS])
1739 AC_ARG_WITH([egl-driver-dir],
1740 [AS_HELP_STRING([--with-egl-driver-dir=DIR],
1741 [directory for EGL drivers [[default=${libdir}/egl]]])],
1742 [EGL_DRIVER_INSTALL_DIR="$withval"],
1743 [EGL_DRIVER_INSTALL_DIR='${libdir}/egl'])
1744 AC_SUBST([EGL_DRIVER_INSTALL_DIR])
1746 AC_ARG_WITH([xorg-driver-dir],
1747 [AS_HELP_STRING([--with-xorg-driver-dir=DIR],
1748 [Default xorg driver directory[[default=${libdir}/xorg/modules/drivers]]])],
1749 [XORG_DRIVER_INSTALL_DIR="$withval"],
1750 [XORG_DRIVER_INSTALL_DIR="${libdir}/xorg/modules/drivers"])
1751 AC_SUBST([XORG_DRIVER_INSTALL_DIR])
1753 AC_ARG_WITH([max-width],
1754 [AS_HELP_STRING([--with-max-width=N],
1755 [Maximum framebuffer width (4096)])],
1756 [DEFINES="${DEFINES} -DMAX_WIDTH=${withval}";
1757 AS_IF([test "${withval}" -gt "4096"],
1758 [AC_MSG_WARN([Large framebuffer: see s_tritemp.h comments.])])]
1760 AC_ARG_WITH([max-height],
1761 [AS_HELP_STRING([--with-max-height=N],
1762 [Maximum framebuffer height (4096)])],
1763 [DEFINES="${DEFINES} -DMAX_HEIGHT=${withval}";
1764 AS_IF([test "${withval}" -gt "4096"],
1765 [AC_MSG_WARN([Large framebuffer: see s_tritemp.h comments.])])]
1771 AC_ARG_ENABLE([gallium-llvm],
1772 [AS_HELP_STRING([--enable-gallium-llvm],
1773 [build gallium LLVM support @<:@default=enabled on x86/x86_64@:>@])],
1774 [enable_gallium_llvm="$enableval"],
1775 [enable_gallium_llvm=auto])
1777 AC_ARG_WITH([llvm-shared-libs],
1778 [AS_HELP_STRING([--with-llvm-shared-libs],
1779 [link with LLVM shared libraries @<:@default=disabled@:>@])],
1780 [with_llvm_shared_libs=yes],
1781 [with_llvm_shared_libs=no])
1783 if test "x$with_gallium_drivers" = x; then
1784 enable_gallium_llvm=no
1786 if test "x$enable_gallium_llvm" = xauto; then
1788 i*86|x86_64) enable_gallium_llvm=yes;;
1791 if test "x$enable_gallium_llvm" = xyes; then
1792 AC_PATH_PROG([LLVM_CONFIG], [llvm-config], [no])
1794 if test "x$LLVM_CONFIG" != xno; then
1795 LLVM_VERSION=`$LLVM_CONFIG --version | sed 's/svn.*//g'`
1796 LLVM_CFLAGS=`$LLVM_CONFIG --cppflags|sed -e 's/-DNDEBUG\>//g' -e 's/-pedantic//g'`
1797 if test "x$with_llvm_shared_libs" = xyes; then
1798 dnl We can't use $LLVM_VERSION because it has 'svn' stripped out,
1799 LLVM_LIBS="-lLLVM-`$LLVM_CONFIG --version`"
1801 LLVM_LIBS="`$LLVM_CONFIG --libs engine bitwriter`"
1803 LLVM_LDFLAGS=`$LLVM_CONFIG --ldflags`
1804 LLVM_BINDIR=`$LLVM_CONFIG --bindir`
1805 LLVM_CXXFLAGS=`$LLVM_CONFIG --cxxflags`
1806 LLVM_INCLUDEDIR=`$LLVM_CONFIG --includedir`
1807 DEFINES="$DEFINES -D__STDC_CONSTANT_MACROS"
1816 dnl Directory for XVMC libs
1817 AC_ARG_WITH([xvmc-libdir],
1818 [AS_HELP_STRING([--with-xvmc-libdir=DIR],
1819 [directory for the XVMC libraries @<:@default=${libdir}@:>@])],
1820 [XVMC_LIB_INSTALL_DIR="$withval"],
1821 [XVMC_LIB_INSTALL_DIR='${libdir}'])
1822 AC_SUBST([XVMC_LIB_INSTALL_DIR])
1824 dnl Directory for VDPAU libs
1825 AC_ARG_WITH([vdpau-libdir],
1826 [AS_HELP_STRING([--with-vdpau-libdir=DIR],
1827 [directory for the VDPAU libraries @<:@default=${libdir}/vdpau@:>@])],
1828 [VDPAU_LIB_INSTALL_DIR="$withval"],
1829 [VDPAU_LIB_INSTALL_DIR='${libdir}/vdpau'])
1830 AC_SUBST([VDPAU_LIB_INSTALL_DIR])
1832 dnl Directory for VA libs
1833 AC_ARG_WITH([va-libdir],
1834 [AS_HELP_STRING([--with-va-libdir=DIR],
1835 [directory for the VA libraries @<:@default=${libdir}/va@:>@])],
1836 [VA_LIB_INSTALL_DIR="$withval"],
1837 [VA_LIB_INSTALL_DIR='${libdir}/va'])
1838 AC_SUBST([VA_LIB_INSTALL_DIR])
1841 dnl Gallium helper functions
1843 gallium_check_st() {
1844 if test "x$HAVE_ST_DRI" = xyes || test "x$HAVE_ST_XORG" = xyes ||
1845 test "x$HAVE_ST_XA" = xyes || test "x$HAVE_ST_XVMC" = xyes ||
1846 test "x$HAVE_ST_VDPAU" = xyes || test "x$HAVE_ST_VA" = xyes; then
1847 if test "x$have_libdrm" != xyes; then
1848 AC_MSG_ERROR([DRI or Xorg DDX requires libdrm >= $LIBDRM_REQUIRED])
1850 GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS $1"
1852 if test "x$HAVE_ST_DRI" = xyes && test "x$2" != x; then
1853 GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS $2"
1855 if test "x$HAVE_ST_XORG" = xyes && test "x$3" != x; then
1856 GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS $3"
1858 if test "x$HAVE_ST_XA" = xyes && test "x$4" != x; then
1859 GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS $4"
1861 if test "x$HAVE_ST_XVMC" = xyes && test "x$5" != x; then
1862 GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS $5"
1864 if test "x$HAVE_ST_VDPAU" = xyes && test "x$6" != x; then
1865 GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS $6"
1867 if test "x$HAVE_ST_VA" = xyes && test "x$7" != x; then
1868 GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS $7"
1872 gallium_require_llvm() {
1873 if test "x$MESA_LLVM" = x0; then
1875 i*86|x86_64) AC_MSG_ERROR([LLVM is required to build $1 on x86 and x86_64]);;
1881 dnl Duplicates in GALLIUM_DRIVERS_DIRS are removed by sorting it after this block
1882 if test "x$with_gallium_drivers" != x; then
1883 gallium_drivers=`IFS=', '; echo $with_gallium_drivers`
1884 for driver in $gallium_drivers; do
1887 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS svga softpipe"
1888 gallium_check_st "svga/drm" "dri-vmwgfx" "" "xa-vmwgfx"
1891 PKG_CHECK_MODULES([INTEL], [libdrm_intel >= $LIBDRM_INTEL_REQUIRED])
1892 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS i915 softpipe"
1893 if test "x$MESA_LLVM" = x1; then
1894 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS llvmpipe"
1896 GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS i915/sw"
1897 gallium_check_st "i915/drm" "dri-i915" "xorg-i915"
1900 PKG_CHECK_MODULES([RADEON], [libdrm_radeon >= $LIBDRM_RADEON_REQUIRED])
1901 gallium_require_llvm "Gallium R300"
1902 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r300"
1903 gallium_check_st "radeon/drm" "dri-r300" "xorg-r300" "" "xvmc-r300" "vdpau-r300" "va-r300"
1906 PKG_CHECK_MODULES([RADEON], [libdrm_radeon >= $LIBDRM_RADEON_REQUIRED])
1907 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r600"
1908 gallium_check_st "radeon/drm" "dri-r600" "xorg-r600" "" "xvmc-r600" "vdpau-r600" "va-r600"
1911 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS radeonsi"
1912 if test "x$LLVM_VERSION" != "x3.1"; then
1913 AC_MSG_ERROR([LLVM 3.1 is required to build the radeonsi driver.])
1915 NEED_RADEON_GALLIUM=yes;
1916 gallium_check_st "radeon/drm" "dri-radeonsi" "xorg-radeonsi"
1919 PKG_CHECK_MODULES([NOUVEAU], [libdrm_nouveau >= $LIBDRM_NOUVEAU_REQUIRED])
1920 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS nouveau nv30 nv50 nvc0"
1921 gallium_check_st "nouveau/drm" "dri-nouveau" "xorg-nouveau" "" "xvmc-nouveau" "vdpau-nouveau"
1924 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS softpipe"
1925 if test "x$MESA_LLVM" = x1; then
1926 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS llvmpipe"
1929 if test "x$HAVE_ST_DRI" = xyes; then
1930 GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS dri-swrast"
1932 if test "x$HAVE_ST_VDPAU" = xyes; then
1933 GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS vdpau-softpipe"
1935 if test "x$HAVE_ST_XVMC" = xyes; then
1936 GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS xvmc-softpipe"
1938 if test "x$HAVE_ST_VA" = xyes; then
1939 GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS va-softpipe"
1941 if test "x$HAVE_ST_VDPAU" = xyes ||
1942 test "x$HAVE_ST_XVMC" = xyes ||
1943 test "x$HAVE_ST_VA" = xyes; then
1944 if test "x$HAVE_WINSYS_XLIB" != xyes; then
1945 GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS sw/xlib"
1950 AC_MSG_ERROR([Unknown Gallium driver: $driver])
1956 dnl Tell Automake which drivers to build
1957 for driver in $GALLIUM_DRIVERS_DIRS; do
1960 HAVE_GALAHAD_GALLIUM=yes;
1963 HAVE_IDENTITY_GALLIUM=yes;
1966 HAVE_NOOP_GALLIUM=yes;
1969 GALLIUM_MAKE_DIRS="$GALLIUM_MAKE_DIRS $driver"
1974 AM_CONDITIONAL(HAVE_GALAHAD_GALLIUM, test x$HAVE_GALAHAD_GALLIUM = xyes)
1975 AM_CONDITIONAL(HAVE_IDENTITY_GALLIUM, test x$HAVE_IDENTITY_GALLIUM = xyes)
1976 AM_CONDITIONAL(HAVE_NOOP_GALLIUM, test x$HAVE_NOOP_GALLIUM = xyes)
1977 AM_CONDITIONAL(NEED_RADEON_GALLIUM, test x$NEED_RADEON_GALLIUM = xyes)
1978 AC_SUBST([GALLIUM_MAKE_DIRS])
1980 dnl prepend CORE_DIRS to SRC_DIRS
1981 SRC_DIRS="$CORE_DIRS $SRC_DIRS"
1983 dnl Restore LDFLAGS and CPPFLAGS
1984 LDFLAGS="$_SAVE_LDFLAGS"
1985 CPPFLAGS="$_SAVE_CPPFLAGS"
1987 dnl Add user CFLAGS and CXXFLAGS
1988 CFLAGS="$CFLAGS $USER_CFLAGS"
1989 CXXFLAGS="$CXXFLAGS $USER_CXXFLAGS"
1991 dnl Substitute the config
1992 AC_CONFIG_FILES([configs/autoconf
1993 src/gallium/drivers/Makefile
1994 src/gallium/drivers/r300/Makefile
1997 src/egl/drivers/Makefile
1998 src/egl/drivers/dri2/Makefile
1999 src/egl/drivers/glx/Makefile
2000 src/egl/main/Makefile
2002 src/egl/wayland/Makefile
2003 src/egl/wayland/wayland-egl/Makefile
2004 src/egl/wayland/wayland-egl/wayland-egl.pc
2005 src/egl/wayland/wayland-drm/Makefile
2007 src/mapi/shared-glapi/Makefile
2009 src/mesa/drivers/dri/dri.pc
2010 src/mesa/drivers/dri/Makefile
2011 src/mesa/drivers/dri/common/Makefile
2012 src/mesa/drivers/dri/i915/Makefile
2013 src/mesa/drivers/dri/i965/Makefile
2014 src/mesa/drivers/dri/nouveau/Makefile
2015 src/mesa/drivers/dri/r200/Makefile
2016 src/mesa/drivers/dri/radeon/Makefile
2017 src/mesa/drivers/dri/swrast/Makefile
2019 tests/glx/Makefile])
2021 dnl Replace the configs/current symlink
2022 AC_CONFIG_COMMANDS([configs],[
2023 if test -f configs/current || test -L configs/current; then
2024 rm -f configs/current
2026 ln -s autoconf configs/current
2029 dnl Sort the dirs alphabetically
2030 GALLIUM_TARGET_DIRS=`echo $GALLIUM_TARGET_DIRS|tr " " "\n"|sort -u|tr "\n" " "`
2031 GALLIUM_WINSYS_DIRS=`echo $GALLIUM_WINSYS_DIRS|tr " " "\n"|sort -u|tr "\n" " "`
2032 GALLIUM_DRIVERS_DIRS=`echo $GALLIUM_DRIVERS_DIRS|tr " " "\n"|sort -u|tr "\n" " "`
2033 GALLIUM_MAKE_DIRS=`echo $GALLIUM_MAKE_DIRS|tr " " "\n"|sort -u|tr "\n" " "`
2034 GALLIUM_STATE_TRACKERS_DIRS=`echo $GALLIUM_STATE_TRACKERS_DIRS|tr " " "\n"|sort -u|tr "\n" " "`
2039 dnl Output some configuration info for the user
2042 echo " prefix: $prefix"
2043 echo " exec_prefix: $exec_prefix"
2044 echo " libdir: $libdir"
2045 echo " includedir: $includedir"
2049 echo " OpenGL: $enable_opengl (ES1: $enable_gles1 ES2: $enable_gles2)"
2050 echo " OpenVG: $enable_openvg"
2054 if test "x$enable_osmesa" != xno; then
2055 echo " OSMesa: lib$OSMESA_LIB"
2060 if test "x$enable_dri" != xno; then
2061 # cleanup the drivers var
2062 dri_dirs=`echo $DRI_DIRS | $SED 's/^ *//;s/ */ /;s/ *$//'`
2063 if test "x$DRI_DIRS" = x; then
2064 echo " DRI drivers: no"
2066 echo " DRI drivers: $dri_dirs"
2068 echo " DRI driver dir: $DRI_DRIVER_INSTALL_DIR"
2071 case "x$enable_glx$enable_xlib_glx" in
2073 echo " GLX: Xlib-based"
2076 echo " GLX: DRI-based"
2079 echo " GLX: $enable_glx"
2084 echo " GLU: $enable_glu"
2088 echo " EGL: $enable_egl"
2089 if test "$enable_egl" = yes; then
2090 echo " EGL platforms: $EGL_PLATFORMS"
2093 if test "x$HAVE_EGL_DRIVER_GLX" != "x"; then
2094 egl_drivers="$egl_drivers builtin:egl_glx"
2096 if test "x$HAVE_EGL_DRIVER_DRI2" != "x"; then
2097 egl_drivers="$egl_drivers builtin:egl_dri2"
2100 if test "x$HAVE_ST_EGL" = xyes; then
2101 echo " EGL drivers: ${egl_drivers} egl_gallium"
2102 echo " EGL Gallium STs:$EGL_CLIENT_APIS"
2104 echo " EGL drivers: $egl_drivers"
2109 if test "x$MESA_LLVM" = x1; then
2111 echo " llvm-config: $LLVM_CONFIG"
2112 echo " llvm-version: $LLVM_VERSION"
2118 if echo "$SRC_DIRS" | grep 'gallium' >/dev/null 2>&1; then
2119 echo " Gallium: yes"
2120 echo " Gallium dirs: $GALLIUM_DIRS"
2121 echo " Target dirs: $GALLIUM_TARGET_DIRS"
2122 echo " Winsys dirs: $GALLIUM_WINSYS_DIRS"
2123 echo " Driver dirs: $GALLIUM_DRIVERS_DIRS"
2124 echo " Trackers dirs: $GALLIUM_STATE_TRACKERS_DIRS"
2132 echo " Shared libs: $enable_shared"
2133 echo " Static libs: $enable_static"
2135 dnl Compiler options
2136 # cleanup the CFLAGS/CXXFLAGS/DEFINES vars
2137 cflags=`echo $CFLAGS $OPT_FLAGS $PIC_FLAGS $ARCH_FLAGS | \
2138 $SED 's/^ *//;s/ */ /;s/ *$//'`
2139 cxxflags=`echo $CXXFLAGS $OPT_FLAGS $PIC_FLAGS $ARCH_FLAGS | \
2140 $SED 's/^ *//;s/ */ /;s/ *$//'`
2141 defines=`echo $DEFINES $ASM_FLAGS | $SED 's/^ *//;s/ */ /;s/ *$//'`
2143 echo " CFLAGS: $cflags"
2144 echo " CXXFLAGS: $cxxflags"
2145 echo " Macros: $defines"
2147 echo " PYTHON2: $PYTHON2"
2150 echo " Run '${MAKE-make}' to build Mesa"