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])
20 dnl Versions for external dependencies
21 LIBDRM_REQUIRED=2.4.15
22 LIBDRM_RADEON_REQUIRED=2.4.17
23 DRI2PROTO_REQUIRED=2.1
24 GLPROTO_REQUIRED=1.4.11
25 LIBDRM_XORG_REQUIRED=2.4.17
26 LIBKMS_XORG_REQUIRED=1.0.0
32 AC_CHECK_PROGS([MAKE], [gmake make])
33 AC_PATH_PROG([MKDEP], [makedepend])
34 AC_PATH_PROG([SED], [sed])
36 dnl Our fallback install-sh is a symlink to minstall. Use the existing
37 dnl configuration in that case.
39 test "x$INSTALL" = "x$ac_install_sh" && INSTALL='$(MINSTALL)'
41 dnl We need a POSIX shell for parts of the build. Assume we have one
45 # Solaris /bin/sh is too old/non-POSIX compliant
46 AC_PATH_PROGS(POSIX_SHELL, [ksh93 ksh sh])
51 dnl clang is mostly GCC-compatible, but its version is much lower,
52 dnl so we have to check for it.
53 AC_MSG_CHECKING([if compiling with clang])
56 [AC_LANG_PROGRAM([], [[
61 [CLANG=yes], [CLANG=no])
63 AC_MSG_RESULT([$CLANG])
65 dnl If we're using GCC, make sure that it is at least version 3.3.0. Older
66 dnl versions are explictly not supported.
67 if test "x$GCC" = xyes -a "x$CLANG" = xno; then
68 AC_MSG_CHECKING([whether gcc version is sufficient])
72 GCC_VERSION=`$CC -dumpversion`
73 if test $? -eq 0; then
74 major=`echo $GCC_VERSION | cut -d. -f1`
75 minor=`echo $GCC_VERSION | cut -d. -f1`
78 if test $major -lt 3 -o $major -eq 3 -a $minor -lt 3 ; then
80 AC_MSG_ERROR([If using GCC, version 3.3.0 or later is required.])
87 MKDEP_OPTIONS=-fdepend
88 dnl Ask gcc where it's keeping its secret headers
89 if test "x$GCC" = xyes; then
90 for dir in include include-fixed; do
91 GCC_INCLUDES=`$CC -print-file-name=$dir`
92 if test "x$GCC_INCLUDES" != x && \
93 test "$GCC_INCLUDES" != "$dir" && \
94 test -d "$GCC_INCLUDES"; then
95 MKDEP_OPTIONS="$MKDEP_OPTIONS -I$GCC_INCLUDES"
99 AC_SUBST([MKDEP_OPTIONS])
101 dnl Make sure the pkg-config macros are defined
102 m4_ifndef([PKG_PROG_PKG_CONFIG],
103 [m4_fatal([Could not locate the pkg-config autoconf macros.
104 These are usually located in /usr/share/aclocal/pkg.m4. If your macros
105 are in a different location, try setting the environment variable
106 ACLOCAL="aclocal -I/other/macro/dir" before running autoreconf.])])
107 PKG_PROG_PKG_CONFIG()
109 dnl LIB_DIR - library basename
110 LIB_DIR=`echo $libdir | $SED 's%.*/%%'`
113 dnl Cache LDFLAGS so we can add EXTRA_LIB_PATH and restore it later
114 _SAVE_LDFLAGS="$LDFLAGS"
115 AC_ARG_VAR([EXTRA_LIB_PATH],[Extra -L paths for the linker])
116 AC_SUBST([EXTRA_LIB_PATH])
118 dnl Cache CPPFLAGS so we can add *_INCLUDES and restore it later
119 _SAVE_CPPFLAGS="$CPPFLAGS"
120 AC_ARG_VAR([X11_INCLUDES],[Extra -I paths for X11 headers])
121 AC_SUBST([X11_INCLUDES])
128 DEFINES="$DEFINES -D_GNU_SOURCE -DPTHREADS"
131 DEFINES="$DEFINES -DPTHREADS -DSVR4"
134 DEFINES="$DEFINES -DPTHREADS"
138 dnl Add flags for gcc and g++
139 if test "x$GCC" = xyes; then
140 CFLAGS="$CFLAGS -Wall -Wmissing-prototypes -std=c99 -ffast-math"
142 # Enable -fvisibility=hidden if using a gcc that supports it
143 save_CFLAGS="$CFLAGS"
144 AC_MSG_CHECKING([whether $CC supports -fvisibility=hidden])
145 CFLAGS="$CFLAGS -fvisibility=hidden"
146 AC_LINK_IFELSE([AC_LANG_PROGRAM()], AC_MSG_RESULT([yes]),
147 [CFLAGS="$save_CFLAGS" ; AC_MSG_RESULT([no])]);
149 # Work around aliasing bugs - developers should comment this out
150 CFLAGS="$CFLAGS -fno-strict-aliasing"
152 if test "x$GXX" = xyes; then
153 CXXFLAGS="$CXXFLAGS -Wall"
155 # Work around aliasing bugs - developers should comment this out
156 CXXFLAGS="$CXXFLAGS -fno-strict-aliasing"
159 dnl These should be unnecessary, but let the user set them if they want
160 AC_ARG_VAR([OPT_FLAGS], [Additional optimization flags for the compiler.
161 Default is to use CFLAGS.])
162 AC_ARG_VAR([ARCH_FLAGS], [Additional architecture specific flags for the
163 compiler. Default is to use CFLAGS.])
164 AC_SUBST([OPT_FLAGS])
165 AC_SUBST([ARCH_FLAGS])
168 dnl Hacks to enable 32 or 64 bit build
170 AC_ARG_ENABLE([32-bit],
171 [AS_HELP_STRING([--enable-32-bit],
172 [build 32-bit libraries @<:@default=auto@:>@])],
173 [enable_32bit="$enableval"],
176 if test "x$enable_32bit" = xyes; then
177 if test "x$GCC" = xyes; then
178 CFLAGS="$CFLAGS -m32"
179 ARCH_FLAGS="$ARCH_FLAGS -m32"
181 if test "x$GXX" = xyes; then
182 CXXFLAGS="$CXXFLAGS -m32"
185 AC_ARG_ENABLE([64-bit],
186 [AS_HELP_STRING([--enable-64-bit],
187 [build 64-bit libraries @<:@default=auto@:>@])],
188 [enable_64bit="$enableval"],
191 if test "x$enable_64bit" = xyes; then
192 if test "x$GCC" = xyes; then
193 CFLAGS="$CFLAGS -m64"
195 if test "x$GXX" = xyes; then
196 CXXFLAGS="$CXXFLAGS -m64"
201 dnl shared/static libraries, mimic libtool options
203 AC_ARG_ENABLE([static],
204 [AS_HELP_STRING([--enable-static],
205 [build static libraries @<:@default=disabled@:>@])],
206 [enable_static="$enableval"],
209 case "x$enable_static" in
211 x ) enable_static=no ;;
213 AC_MSG_ERROR([Static library option '$enable_static' is not a valid])
216 AC_ARG_ENABLE([shared],
217 [AS_HELP_STRING([--disable-shared],
218 [build shared libraries @<:@default=enabled@:>@])],
219 [enable_shared="$enableval"],
222 case "x$enable_shared" in
224 x ) enable_shared=yes ;;
226 AC_MSG_ERROR([Shared library option '$enable_shared' is not a valid])
230 dnl Can't have static and shared libraries, default to static if user
231 dnl explicitly requested. If both disabled, set to static since shared
232 dnl was explicitly requirested.
233 case "x$enable_static$enable_shared" in
235 AC_MSG_WARN([Can't build static and shared libraries, disabling shared])
239 AC_MSG_WARN([Can't disable both static and shared libraries, enabling static])
247 AC_ARG_VAR([MKLIB_OPTIONS],[Options for the Mesa library script, mklib])
248 if test "$enable_static" = yes; then
249 MKLIB_OPTIONS="$MKLIB_OPTIONS -static"
251 AC_SUBST([MKLIB_OPTIONS])
254 dnl other compiler options
256 AC_ARG_ENABLE([debug],
257 [AS_HELP_STRING([--enable-debug],
258 [use debug compiler flags and macros @<:@default=disabled@:>@])],
259 [enable_debug="$enableval"],
262 if test "x$enable_debug" = xyes; then
263 DEFINES="$DEFINES -DDEBUG"
264 if test "x$GCC" = xyes; then
267 if test "x$GXX" = xyes; then
268 CXXFLAGS="$CXXFLAGS -g"
275 if test "$enable_static" = yes; then
280 LIB_EXTENSION='dylib' ;;
282 LIB_EXTENSION='dll.a' ;;
286 LIB_EXTENSION='so' ;;
290 GL_LIB_NAME='lib$(GL_LIB).'${LIB_EXTENSION}
291 GLU_LIB_NAME='lib$(GLU_LIB).'${LIB_EXTENSION}
292 GLUT_LIB_NAME='lib$(GLUT_LIB).'${LIB_EXTENSION}
293 GLW_LIB_NAME='lib$(GLW_LIB).'${LIB_EXTENSION}
294 OSMESA_LIB_NAME='lib$(OSMESA_LIB).'${LIB_EXTENSION}
295 EGL_LIB_NAME='lib$(EGL_LIB).'${LIB_EXTENSION}
296 GLESv1_CM_LIB_NAME='lib$(GLESv1_CM_LIB).'${LIB_EXTENSION}
297 GLESv2_LIB_NAME='lib$(GLESv2_LIB).'${LIB_EXTENSION}
298 VG_LIB_NAME='lib$(VG_LIB).'${LIB_EXTENSION}
300 GL_LIB_GLOB='lib$(GL_LIB).*'${LIB_EXTENSION}'*'
301 GLU_LIB_GLOB='lib$(GLU_LIB).*'${LIB_EXTENSION}'*'
302 GLUT_LIB_GLOB='lib$(GLUT_LIB).*'${LIB_EXTENSION}'*'
303 GLW_LIB_GLOB='lib$(GLW_LIB).*'${LIB_EXTENSION}'*'
304 OSMESA_LIB_GLOB='lib$(OSMESA_LIB).*'${LIB_EXTENSION}'*'
305 EGL_LIB_GLOB='lib$(EGL_LIB).*'${LIB_EXTENSION}'*'
306 GLESv1_CM_LIB_GLOB='lib$(GLESv1_CM_LIB).*'${LIB_EXTENSION}'*'
307 GLESv2_LIB_GLOB='lib$(GLESv2_LIB).*'${LIB_EXTENSION}'*'
308 VG_LIB_GLOB='lib$(VG_LIB).*'${LIB_EXTENSION}'*'
310 AC_SUBST([GL_LIB_NAME])
311 AC_SUBST([GLU_LIB_NAME])
312 AC_SUBST([GLUT_LIB_NAME])
313 AC_SUBST([GLW_LIB_NAME])
314 AC_SUBST([OSMESA_LIB_NAME])
315 AC_SUBST([EGL_LIB_NAME])
316 AC_SUBST([GLESv1_CM_LIB_NAME])
317 AC_SUBST([GLESv2_LIB_NAME])
318 AC_SUBST([VG_LIB_NAME])
320 AC_SUBST([GL_LIB_GLOB])
321 AC_SUBST([GLU_LIB_GLOB])
322 AC_SUBST([GLUT_LIB_GLOB])
323 AC_SUBST([GLW_LIB_GLOB])
324 AC_SUBST([OSMESA_LIB_GLOB])
325 AC_SUBST([EGL_LIB_GLOB])
326 AC_SUBST([GLESv1_CM_LIB_GLOB])
327 AC_SUBST([GLESv2_LIB_GLOB])
328 AC_SUBST([VG_LIB_GLOB])
331 dnl Arch/platform-specific settings
334 [AS_HELP_STRING([--disable-asm],
335 [disable assembly usage @<:@default=enabled on supported plaforms@:>@])],
336 [enable_asm="$enableval"],
343 AC_MSG_CHECKING([whether to enable assembly])
344 test "x$enable_asm" = xno && AC_MSG_RESULT([no])
345 # disable if cross compiling on x86/x86_64 since we must run gen_matypes
346 if test "x$enable_asm" = xyes && test "x$cross_compiling" = xyes; then
350 AC_MSG_RESULT([no, cross compiling])
354 # check for supported arches
355 if test "x$enable_asm" = xyes; then
359 linux* | *freebsd* | dragonfly*)
360 test "x$enable_64bit" = xyes && asm_arch=x86_64 || asm_arch=x86
366 linux* | *freebsd* | dragonfly*)
367 test "x$enable_32bit" = xyes && asm_arch=x86 || asm_arch=x86_64
389 ASM_FLAGS="-DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM"
390 MESA_ASM_SOURCES='$(X86_SOURCES)'
391 GLAPI_ASM_SOURCES='$(X86_API)'
392 AC_MSG_RESULT([yes, x86])
395 ASM_FLAGS="-DUSE_X86_64_ASM"
396 MESA_ASM_SOURCES='$(X86-64_SOURCES)'
397 GLAPI_ASM_SOURCES='$(X86-64_API)'
398 AC_MSG_RESULT([yes, x86_64])
401 ASM_FLAGS="-DUSE_PPC_ASM -DUSE_VMX_ASM"
402 MESA_ASM_SOURCES='$(PPC_SOURCES)'
403 AC_MSG_RESULT([yes, ppc])
406 ASM_FLAGS="-DUSE_SPARC_ASM"
407 MESA_ASM_SOURCES='$(SPARC_SOURCES)'
408 GLAPI_ASM_SOURCES='$(SPARC_API)'
409 AC_MSG_RESULT([yes, sparc])
412 AC_MSG_RESULT([no, platform not supported])
416 AC_SUBST([ASM_FLAGS])
417 AC_SUBST([MESA_ASM_SOURCES])
418 AC_SUBST([GLAPI_ASM_SOURCES])
423 dnl Check to see if dlopen is in default libraries (like Solaris, which
424 dnl has it in libc), or if libdl is needed to get it.
425 AC_CHECK_FUNC([dlopen], [],
426 [AC_CHECK_LIB([dl], [dlopen], [DLOPEN_LIBS="-ldl"])])
427 AC_SUBST([DLOPEN_LIBS])
429 dnl See if posix_memalign is available
430 AC_CHECK_FUNC([posix_memalign], [DEFINES="$DEFINES -DHAVE_POSIX_MEMALIGN"])
432 dnl SELinux awareness.
433 AC_ARG_ENABLE([selinux],
434 [AS_HELP_STRING([--enable-selinux],
435 [Build SELinux-aware Mesa @<:@default=disabled@:>@])],
436 [MESA_SELINUX="$enableval"],
438 if test "x$enable_selinux" = "xyes"; then
439 AC_CHECK_HEADER([selinux/selinux.h],[],
440 [AC_MSG_ERROR([SELinux headers not found])])
441 AC_CHECK_LIB([selinux],[is_selinux_enabled],[],
442 [AC_MSG_ERROR([SELinux library not found])])
443 SELINUX_LIBS="-lselinux"
444 DEFINES="$DEFINES -DMESA_SELINUX"
448 dnl Driver configuration. Options are xlib, dri and osmesa right now.
449 dnl More later: fbdev, ...
451 default_driver="xlib"
456 i*86|x86_64|powerpc*|sparc*) default_driver="dri";;
459 *freebsd* | dragonfly*)
461 i*86|x86_64|powerpc*|sparc*) default_driver="dri";;
466 AC_ARG_WITH([driver],
467 [AS_HELP_STRING([--with-driver=DRIVER],
468 [driver for Mesa: xlib,dri,osmesa @<:@default=dri when available, or xlib@:>@])],
469 [mesa_driver="$withval"],
470 [mesa_driver="$default_driver"])
471 dnl Check for valid option
472 case "x$mesa_driver" in
476 AC_MSG_ERROR([Driver '$mesa_driver' is not a valid option])
480 PKG_CHECK_MODULES([TALLOC], [talloc])
481 AC_SUBST([TALLOC_LIBS])
482 AC_SUBST([TALLOC_CFLAGS])
485 dnl Driver specific build directories
488 dnl this variable will be prepended to SRC_DIRS and is not exported
489 CORE_DIRS="mapi/glapi glsl mesa"
493 GALLIUM_DIRS="auxiliary drivers state_trackers"
494 GALLIUM_TARGET_DIRS=""
495 GALLIUM_WINSYS_DIRS="sw"
496 GALLIUM_DRIVERS_DIRS="softpipe failover galahad trace rbug identity"
497 GALLIUM_STATE_TRACKERS_DIRS=""
499 case "$mesa_driver" in
502 GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS sw/xlib"
503 GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS libgl-xlib"
506 SRC_DIRS="$SRC_DIRS glx"
508 GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS sw/xlib sw/dri"
516 AC_SUBST([DRIVER_DIRS])
517 AC_SUBST([GALLIUM_DIRS])
518 AC_SUBST([GALLIUM_TARGET_DIRS])
519 AC_SUBST([GALLIUM_WINSYS_DIRS])
520 AC_SUBST([GALLIUM_DRIVERS_DIRS])
521 AC_SUBST([GALLIUM_STATE_TRACKERS_DIRS])
522 AC_SUBST([MESA_LLVM])
525 dnl Find out if X is available. The variable have_x is set if libX11 is
526 dnl found to mimic AC_PATH_XTRA.
528 if test -n "$PKG_CONFIG"; then
529 AC_MSG_CHECKING([pkg-config files for X11 are available])
530 PKG_CHECK_EXISTS([x11],[
536 AC_MSG_RESULT([$x11_pkgconfig])
540 dnl Use the autoconf macro if no pkg-config files
541 if test "$x11_pkgconfig" = yes; then
542 PKG_CHECK_MODULES([X11], [x11])
545 test -z "$X11_CFLAGS" && X11_CFLAGS="$X_CFLAGS"
546 test -z "$X11_LIBS" && X11_LIBS="$X_LIBS -lX11"
547 AC_SUBST([X11_CFLAGS])
551 dnl Try to tell the user that the --x-* options are only used when
552 dnl pkg-config is not available. This must be right after AC_PATH_XTRA.
553 m4_divert_once([HELP_BEGIN],
554 [These options are only used when the X libraries cannot be found by the
555 pkg-config utility.])
557 dnl We need X for xlib and dri, so bomb now if it's not found
558 case "$mesa_driver" in
560 if test "$no_x" = yes; then
561 AC_MSG_ERROR([X11 development libraries needed for $mesa_driver driver])
566 dnl XCB - this is only used for GLX right now
568 [AS_HELP_STRING([--enable-xcb],
569 [use XCB for GLX @<:@default=disabled@:>@])],
570 [enable_xcb="$enableval"],
572 if test "x$enable_xcb" = xyes; then
573 DEFINES="$DEFINES -DUSE_XCB"
579 dnl libGL configuration per driver
581 case "$mesa_driver" in
583 if test "$x11_pkgconfig" = yes; then
584 PKG_CHECK_MODULES([XLIBGL], [x11 xext])
585 GL_PC_REQ_PRIV="x11 xext"
586 X11_INCLUDES="$X11_INCLUDES $XLIBGL_CFLAGS"
587 GL_LIB_DEPS="$XLIBGL_LIBS"
589 # should check these...
590 X11_INCLUDES="$X11_INCLUDES $X_CFLAGS"
591 GL_LIB_DEPS="$X_LIBS -lX11 -lXext"
592 GL_PC_LIB_PRIV="$GL_LIB_DEPS"
593 GL_PC_CFLAGS="$X11_INCLUDES"
595 GL_LIB_DEPS="$GL_LIB_DEPS $SELINUX_LIBS -lm -lpthread $TALLOC_LIBS"
596 GL_PC_LIB_PRIV="$GL_PC_LIB_PRIV $SELINUX_LIBS -lm -lpthread $TALLOC_LIBS"
598 # if static, move the external libraries to the programs
599 # and empty the libraries for libGL
600 if test "$enable_static" = yes; then
601 APP_LIB_DEPS="$APP_LIB_DEPS $GL_LIB_DEPS"
606 # DRI must be shared, I think
607 if test "$enable_static" = yes; then
608 AC_MSG_ERROR([Can't use static libraries for DRI drivers])
612 PKG_CHECK_MODULES([LIBDRM], [libdrm >= $LIBDRM_REQUIRED])
613 PKG_CHECK_MODULES([DRI2PROTO], [dri2proto >= $DRI2PROTO_REQUIRED])
614 PKG_CHECK_MODULES([GLPROTO], [glproto >= $GLPROTO_REQUIRED])
615 GL_PC_REQ_PRIV="libdrm >= $LIBDRM_REQUIRED dri2proto >= $DRI2PROTO_REQUIRED glproto >= $GLPROTO_REQUIRED"
616 DRI_PC_REQ_PRIV="libdrm >= $LIBDRM_REQUIRED"
618 # find the DRI deps for libGL
619 if test "$x11_pkgconfig" = yes; then
620 # add xcb modules if necessary
621 dri_modules="x11 xext xxf86vm xdamage xfixes"
622 if test "$enable_xcb" = yes; then
623 dri_modules="$dri_modules x11-xcb xcb-glx"
626 PKG_CHECK_MODULES([DRIGL], [$dri_modules])
627 GL_PC_REQ_PRIV="$GL_PC_REQ_PRIV $dri_modules"
628 X11_INCLUDES="$X11_INCLUDES $DRIGL_CFLAGS"
629 GL_LIB_DEPS="$DRIGL_LIBS"
631 # should check these...
632 X11_INCLUDES="$X11_INCLUDES $X_CFLAGS"
633 GL_LIB_DEPS="$X_LIBS -lX11 -lXext -lXxf86vm -lXdamage -lXfixes"
634 GL_PC_LIB_PRIV="$GL_LIB_DEPS"
635 GL_PC_CFLAGS="$X11_INCLUDES"
637 # XCB can only be used from pkg-config
638 if test "$enable_xcb" = yes; then
639 PKG_CHECK_MODULES([XCB],[x11-xcb xcb-glx])
640 GL_PC_REQ_PRIV="$GL_PC_REQ_PRIV x11-xcb xcb-glx"
641 X11_INCLUDES="$X11_INCLUDES $XCB_CFLAGS"
642 GL_LIB_DEPS="$GL_LIB_DEPS $XCB_LIBS"
646 # need DRM libs, -lpthread, etc.
647 GL_LIB_DEPS="$GL_LIB_DEPS $LIBDRM_LIBS -lm -lpthread $DLOPEN_LIBS"
648 GL_PC_LIB_PRIV="-lm -lpthread $DLOPEN_LIBS"
649 GLESv1_CM_LIB_DEPS="$LIBDRM_LIBS -lm -lpthread $DLOPEN_LIBS"
650 GLESv1_CM_PC_LIB_PRIV="-lm -lpthread $DLOPEN_LIBS"
651 GLESv2_LIB_DEPS="$LIBDRM_LIBS -lm -lpthread $DLOPEN_LIBS"
652 GLESv2_PC_LIB_PRIV="-lm -lpthread $DLOPEN_LIBS"
655 # No libGL for osmesa
659 AC_SUBST([GL_LIB_DEPS])
660 AC_SUBST([GL_PC_REQ_PRIV])
661 AC_SUBST([GL_PC_LIB_PRIV])
662 AC_SUBST([GL_PC_CFLAGS])
663 AC_SUBST([DRI_PC_REQ_PRIV])
664 AC_SUBST([GLESv1_CM_LIB_DEPS])
665 AC_SUBST([GLESv1_CM_PC_LIB_PRIV])
666 AC_SUBST([GLESv2_LIB_DEPS])
667 AC_SUBST([GLESv2_PC_LIB_PRIV])
673 if test "$mesa_driver" = xlib; then
674 DEFINES="$DEFINES -DUSE_XSHM"
680 AC_ARG_ENABLE([glx-tls],
681 [AS_HELP_STRING([--enable-glx-tls],
682 [enable TLS support in GLX @<:@default=disabled@:>@])],
683 [GLX_USE_TLS="$enableval"],
685 dnl Directory for DRI drivers
686 AC_ARG_WITH([dri-driverdir],
687 [AS_HELP_STRING([--with-dri-driverdir=DIR],
688 [directory for the DRI drivers @<:@${libdir}/dri@:>@])],
689 [DRI_DRIVER_INSTALL_DIR="$withval"],
690 [DRI_DRIVER_INSTALL_DIR='${libdir}/dri'])
691 AC_SUBST([DRI_DRIVER_INSTALL_DIR])
692 dnl Extra search path for DRI drivers
693 AC_ARG_WITH([dri-searchpath],
694 [AS_HELP_STRING([--with-dri-searchpath=DIRS...],
695 [semicolon delimited DRI driver search directories @<:@${libdir}/dri@:>@])],
696 [DRI_DRIVER_SEARCH_DIR="$withval"],
697 [DRI_DRIVER_SEARCH_DIR='${DRI_DRIVER_INSTALL_DIR}'])
698 AC_SUBST([DRI_DRIVER_SEARCH_DIR])
699 dnl Direct rendering or just indirect rendering
700 AC_ARG_ENABLE([driglx-direct],
701 [AS_HELP_STRING([--disable-driglx-direct],
702 [enable direct rendering in GLX and EGL for DRI @<:@default=enabled@:>@])],
703 [driglx_direct="$enableval"],
704 [driglx_direct="yes"])
705 dnl Which drivers to build - default is chosen by platform
706 AC_ARG_WITH([dri-drivers],
707 [AS_HELP_STRING([--with-dri-drivers@<:@=DIRS...@:>@],
708 [comma delimited DRI drivers list, e.g.
709 "swrast,i965,radeon" @<:@default=auto@:>@])],
710 [with_dri_drivers="$withval"],
711 [with_dri_drivers=yes])
712 if test "x$with_dri_drivers" = x; then
716 dnl Determine which APIs to support
717 AC_ARG_ENABLE([opengl],
718 [AS_HELP_STRING([--disable-opengl],
719 [disable support for standard OpenGL API @<:@default=no@:>@])],
720 [enable_opengl="$enableval"],
722 AC_ARG_ENABLE([gles1],
723 [AS_HELP_STRING([--enable-gles1],
724 [enable support for OpenGL ES 1.x API @<:@default=no@:>@])],
725 [enable_gles1="$enableval"],
727 AC_ARG_ENABLE([gles2],
728 [AS_HELP_STRING([--enable-gles2],
729 [enable support for OpenGL ES 2.x API @<:@default=no@:>@])],
730 [enable_gles2="$enableval"],
732 AC_ARG_ENABLE([gles-overlay],
733 [AS_HELP_STRING([--enable-gles-overlay],
734 [build separate OpenGL ES only libraries @<:@default=no@:>@])],
735 [enable_gles_overlay="$enableval"],
736 [enable_gles_overlay=no])
740 if test "x$enable_opengl" = xno; then
741 API_DEFINES="$API_DEFINES -DFEATURE_GL=0"
743 API_DEFINES="$API_DEFINES -DFEATURE_GL=1"
745 if test "x$enable_gles1" = xyes; then
746 API_DEFINES="$API_DEFINES -DFEATURE_ES1=1"
748 if test "x$enable_gles2" = xyes; then
749 API_DEFINES="$API_DEFINES -DFEATURE_ES2=1"
751 if test "x$enable_gles_overlay" = xyes -o \
752 "x$enable_gles1" = xyes -o "x$enable_gles2" = xyes; then
753 CORE_DIRS="mapi/es1api mapi/es2api $CORE_DIRS"
754 if test "x$enable_gles_overlay" = xyes; then
758 AC_SUBST([API_DEFINES])
759 AC_SUBST([GLES_OVERLAY])
761 dnl If $with_dri_drivers is yes, directories will be added through
764 case "$with_dri_drivers" in
770 # verify the requested driver directories exist
771 dri_drivers=`IFS=', '; echo $with_dri_drivers`
772 for driver in $dri_drivers; do
773 test -d "$srcdir/src/mesa/drivers/dri/$driver" || \
774 AC_MSG_ERROR([DRI driver directory '$driver' doesn't exist])
776 DRI_DIRS="$dri_drivers"
780 dnl Set DRI_DIRS, DEFINES and LIB_DEPS
781 if test "$mesa_driver" = dri; then
783 if test "x$GLX_USE_TLS" = xyes; then
784 DEFINES="$DEFINES -DGLX_USE_TLS -DPTHREADS"
787 # Platform specific settings and drivers to build
790 DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
791 if test "x$driglx_direct" = xyes; then
792 DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
794 DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING -DHAVE_ALIAS"
798 # sis is missing because they have not be converted to use
799 # the new interface. i810 are missing because there is no
800 # x86-64 system where they could *ever* be used.
801 if test "x$DRI_DIRS" = "xyes"; then
802 DRI_DIRS="i915 i965 mach64 mga r128 r200 r300 r600 radeon \
803 savage tdfx unichrome swrast"
807 # Build only the drivers for cards that exist on PowerPC.
808 # At some point MGA will be added, but not yet.
809 if test "x$DRI_DIRS" = "xyes"; then
810 DRI_DIRS="mach64 r128 r200 r300 r600 radeon tdfx swrast"
814 # Build only the drivers for cards that exist on sparc`
815 if test "x$DRI_DIRS" = "xyes"; then
816 DRI_DIRS="mach64 r128 r200 r300 r600 radeon swrast"
821 freebsd* | dragonfly*)
822 DEFINES="$DEFINES -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1"
823 DEFINES="$DEFINES -DIN_DRI_DRIVER -DHAVE_ALIAS"
824 DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING"
825 if test "x$driglx_direct" = xyes; then
826 DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
828 if test "x$GXX" = xyes; then
829 CXXFLAGS="$CXXFLAGS -ansi -pedantic"
832 if test "x$DRI_DIRS" = "xyes"; then
833 DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 r600 radeon tdfx \
834 unichrome savage sis swrast"
838 DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
839 DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING -DHAVE_ALIAS"
842 DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
843 DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING"
844 if test "x$driglx_direct" = xyes; then
845 DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
851 if test "x$DRI_DIRS" = "xyes"; then
852 DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 r600 radeon \
853 savage sis tdfx unichrome swrast"
856 DRI_DIRS=`echo "$DRI_DIRS" | $SED 's/ */ /g'`
862 [AS_HELP_STRING([--with-expat=DIR],
863 [expat install directory])],[
864 EXPAT_INCLUDES="-I$withval/include"
865 CPPFLAGS="$CPPFLAGS $EXPAT_INCLUDES"
866 LDFLAGS="$LDFLAGS -L$withval/$LIB_DIR"
867 EXPAT_LIB="-L$withval/$LIB_DIR -lexpat"
869 AC_CHECK_HEADER([expat.h],[],[AC_MSG_ERROR([Expat required for DRI.])])
870 AC_CHECK_LIB([expat],[XML_ParserCreate],[],
871 [AC_MSG_ERROR([Expat required for DRI.])])
873 # put all the necessary libs together
874 DRI_LIB_DEPS="$SELINUX_LIBS $LIBDRM_LIBS $EXPAT_LIB -lm -lpthread $DLOPEN_LIBS $TALLOC_LIBS"
877 AC_SUBST([EXPAT_INCLUDES])
878 AC_SUBST([DRI_LIB_DEPS])
882 PKG_CHECK_MODULES([INTEL], [libdrm_intel >= 2.4.21])
887 *radeon*|*r200*|*r300*|*r600*)
888 PKG_CHECK_MODULES([LIBDRM_RADEON],
889 [libdrm_radeon libdrm >= $LIBDRM_RADEON_REQUIRED],
890 HAVE_LIBDRM_RADEON=yes,
891 HAVE_LIBDRM_RADEON=no)
893 if test "$HAVE_LIBDRM_RADEON" = yes; then
894 RADEON_CFLAGS="-DHAVE_LIBDRM_RADEON=1 $LIBDRM_RADEON_CFLAGS"
895 RADEON_LDFLAGS=$LIBDRM_RADEON_LIBS
899 AC_SUBST([RADEON_CFLAGS])
900 AC_SUBST([RADEON_LDFLAGS])
904 dnl OSMesa configuration
906 if test "$mesa_driver" = xlib; then
907 default_gl_osmesa=yes
911 AC_ARG_ENABLE([gl-osmesa],
912 [AS_HELP_STRING([--enable-gl-osmesa],
913 [enable OSMesa with libGL @<:@default=enabled for xlib driver@:>@])],
914 [gl_osmesa="$enableval"],
915 [gl_osmesa="$default_gl_osmesa"])
916 if test "x$gl_osmesa" = xyes; then
917 if test "$mesa_driver" = osmesa; then
918 AC_MSG_ERROR([libGL is not available for OSMesa driver])
920 DRIVER_DIRS="$DRIVER_DIRS osmesa"
924 dnl Configure the channel bits for OSMesa (libOSMesa, libOSMesa16, ...)
925 AC_ARG_WITH([osmesa-bits],
926 [AS_HELP_STRING([--with-osmesa-bits=BITS],
927 [OSMesa channel bits and library name: 8, 16, 32 @<:@default=8@:>@])],
928 [osmesa_bits="$withval"],
930 if test "$mesa_driver" != osmesa && test "x$osmesa_bits" != x8; then
931 AC_MSG_WARN([Ignoring OSMesa channel bits for non-OSMesa driver])
934 case "x$osmesa_bits" in
939 OSMESA_LIB="OSMesa$osmesa_bits"
940 DEFINES="$DEFINES -DCHAN_BITS=$osmesa_bits -DDEFAULT_SOFTWARE_DEPTH_BITS=31"
943 AC_MSG_ERROR([OSMesa bits '$osmesa_bits' is not a valid option])
946 AC_SUBST([OSMESA_LIB])
948 case "$DRIVER_DIRS" in
950 # only link libraries with osmesa if shared
951 if test "$enable_static" = no; then
952 OSMESA_LIB_DEPS="-lm -lpthread $SELINUX_LIBS $DLOPEN_LIBS $TALLOC_LIBS"
957 OSMESA_PC_LIB_PRIV="-lm -lpthread $SELINUX_LIBS $DLOPEN_LIBS $TALLOC_LIBS"
960 AC_SUBST([OSMESA_LIB_DEPS])
961 AC_SUBST([OSMESA_MESA_DEPS])
962 AC_SUBST([OSMESA_PC_REQ])
963 AC_SUBST([OSMESA_PC_LIB_PRIV])
966 dnl EGL configuration
969 [AS_HELP_STRING([--disable-egl],
970 [disable EGL library @<:@default=enabled@:>@])],
971 [enable_egl="$enableval"],
973 if test "x$enable_egl" = xyes; then
974 SRC_DIRS="$SRC_DIRS egl"
975 EGL_LIB_DEPS="$DLOPEN_LIBS -lpthread"
977 if test "$enable_static" != yes; then
978 # build egl_glx when libGL is built
979 if test "$mesa_driver" != osmesa; then
980 EGL_DRIVERS_DIRS="glx"
983 if test "$mesa_driver" = dri; then
984 # build egl_dri2 when xcb-dri2 is available
985 PKG_CHECK_MODULES([XCB_DRI2], [x11-xcb xcb-dri2 xcb-xfixes],
986 [have_xcb_dri2=yes],[have_xcb_dri2=no])
987 PKG_CHECK_MODULES([LIBUDEV], [libudev > 150],
988 [have_libudev=yes],[have_libudev=no])
990 if test "$have_xcb_dri2" = yes; then
992 DEFINES="$DEFINES -DHAVE_XCB_DRI2"
993 if test "$have_libudev" = yes; then
994 DEFINES="$DEFINES -DHAVE_LIBUDEV"
999 EGL_DRIVERS_DIRS="$EGL_DRIVERS_DIRS $EGL_DRIVER_DRI2"
1002 AC_SUBST([EGL_LIB_DEPS])
1003 AC_SUBST([EGL_DRIVERS_DIRS])
1006 dnl GLU configuration
1008 AC_ARG_ENABLE([glu],
1009 [AS_HELP_STRING([--disable-glu],
1010 [enable OpenGL Utility library @<:@default=enabled@:>@])],
1011 [enable_glu="$enableval"],
1013 if test "x$enable_glu" = xyes; then
1014 SRC_DIRS="$SRC_DIRS glu"
1016 case "$mesa_driver" in
1018 # Link libGLU to libOSMesa instead of libGL
1021 if test "$enable_static" = no; then
1022 GLU_MESA_DEPS='-l$(OSMESA_LIB)'
1028 # If static, empty GLU_LIB_DEPS and add libs for programs to link
1030 GLU_PC_LIB_PRIV="-lm"
1031 if test "$enable_static" = no; then
1033 GLU_MESA_DEPS='-l$(GL_LIB)'
1037 APP_LIB_DEPS="$APP_LIB_DEPS -lstdc++"
1042 if test "$enable_static" = no; then
1043 GLU_LIB_DEPS="$GLU_LIB_DEPS $OS_CPLUSPLUS_LIBS"
1045 GLU_PC_LIB_PRIV="$GLU_PC_LIB_PRIV $OS_CPLUSPLUS_LIBS"
1046 AC_SUBST([GLU_LIB_DEPS])
1047 AC_SUBST([GLU_MESA_DEPS])
1048 AC_SUBST([GLU_PC_REQ])
1049 AC_SUBST([GLU_PC_REQ_PRIV])
1050 AC_SUBST([GLU_PC_LIB_PRIV])
1051 AC_SUBST([GLU_PC_CFLAGS])
1054 dnl GLw configuration
1056 AC_ARG_ENABLE([glw],
1057 [AS_HELP_STRING([--disable-glw],
1058 [enable Xt/Motif widget library @<:@default=enabled@:>@])],
1059 [enable_glw="$enableval"],
1061 dnl Don't build GLw on osmesa
1062 if test "x$enable_glw" = xyes && test "$mesa_driver" = osmesa; then
1063 AC_MSG_WARN([Disabling GLw since the driver is OSMesa])
1066 AC_ARG_ENABLE([motif],
1067 [AS_HELP_STRING([--enable-motif],
1068 [use Motif widgets in GLw @<:@default=disabled@:>@])],
1069 [enable_motif="$enableval"],
1072 if test "x$enable_glw" = xyes; then
1073 SRC_DIRS="$SRC_DIRS glw"
1074 if test "$x11_pkgconfig" = yes; then
1075 PKG_CHECK_MODULES([GLW],[x11 xt])
1076 GLW_PC_REQ_PRIV="x11 xt"
1077 GLW_LIB_DEPS="$GLW_LIBS"
1079 # should check these...
1080 GLW_LIB_DEPS="$X_LIBS -lXt -lX11"
1081 GLW_PC_LIB_PRIV="$GLW_LIB_DEPS"
1082 GLW_PC_CFLAGS="$X11_INCLUDES"
1085 GLW_SOURCES="GLwDrawA.c"
1087 if test "x$enable_motif" = xyes; then
1088 GLW_SOURCES="$GLW_SOURCES GLwMDrawA.c"
1089 AC_PATH_PROG([MOTIF_CONFIG], [motif-config], [no])
1090 if test "x$MOTIF_CONFIG" != xno; then
1091 MOTIF_CFLAGS=`$MOTIF_CONFIG --cflags`
1092 MOTIF_LIBS=`$MOTIF_CONFIG --libs`
1094 AC_CHECK_HEADER([Xm/PrimitiveP.h], [],
1095 [AC_MSG_ERROR([Can't locate Motif headers])])
1096 AC_CHECK_LIB([Xm], [XmGetPixmap], [MOTIF_LIBS="-lXm"],
1097 [AC_MSG_ERROR([Can't locate Motif Xm library])])
1099 # MOTIF_LIBS is prepended to GLW_LIB_DEPS since Xm needs Xt/X11
1100 GLW_LIB_DEPS="$MOTIF_LIBS $GLW_LIB_DEPS"
1101 GLW_PC_LIB_PRIV="$MOTIF_LIBS $GLW_PC_LIB_PRIV"
1102 GLW_PC_CFLAGS="$MOTIF_CFLAGS $GLW_PC_CFLAGS"
1105 # If static, empty GLW_LIB_DEPS and add libs for programs to link
1106 GLW_PC_LIB_PRIV="$GLW_PC_LIB_PRIV"
1107 if test "$enable_static" = no; then
1108 GLW_MESA_DEPS='-l$(GL_LIB)'
1109 GLW_LIB_DEPS="$GLW_LIB_DEPS"
1111 APP_LIB_DEPS="$APP_LIB_DEPS $GLW_LIB_DEPS"
1116 AC_SUBST([GLW_LIB_DEPS])
1117 AC_SUBST([GLW_MESA_DEPS])
1118 AC_SUBST([GLW_SOURCES])
1119 AC_SUBST([MOTIF_CFLAGS])
1120 AC_SUBST([GLW_PC_REQ_PRIV])
1121 AC_SUBST([GLW_PC_LIB_PRIV])
1122 AC_SUBST([GLW_PC_CFLAGS])
1125 dnl GLUT configuration
1127 if test -f "$srcdir/include/GL/glut.h"; then
1132 AC_ARG_ENABLE([glut],
1133 [AS_HELP_STRING([--disable-glut],
1134 [enable GLUT library @<:@default=enabled if source available@:>@])],
1135 [enable_glut="$enableval"],
1136 [enable_glut="$default_glut"])
1138 dnl Can't build glut if GLU not available
1139 if test "x$enable_glu$enable_glut" = xnoyes; then
1140 AC_MSG_WARN([Disabling glut since GLU is disabled])
1143 dnl Don't build glut on osmesa
1144 if test "x$enable_glut" = xyes && test "$mesa_driver" = osmesa; then
1145 AC_MSG_WARN([Disabling glut since the driver is OSMesa])
1149 if test "x$enable_glut" = xyes; then
1150 SRC_DIRS="$SRC_DIRS glut/glx"
1151 if test "$x11_pkgconfig" = yes; then
1152 PKG_CHECK_MODULES([GLUT],[x11 xmu xi])
1153 GLUT_PC_REQ_PRIV="x11 xmu xi"
1154 GLUT_LIB_DEPS="$GLUT_LIBS"
1156 # should check these...
1157 GLUT_LIB_DEPS="$X_LIBS -lX11 -lXmu -lXi"
1158 GLUT_PC_LIB_PRIV="$GLUT_LIB_DEPS"
1159 GLUT_PC_CFLAGS="$X11_INCLUDES"
1161 if test "x$GCC" = xyes; then
1162 GLUT_CFLAGS="$GLUT_CFLAGS -fexceptions"
1164 GLUT_LIB_DEPS="$GLUT_LIB_DEPS -lm"
1165 GLUT_PC_LIB_PRIV="$GLUT_PC_LIB_PRIV -lm"
1167 # If static, empty GLUT_LIB_DEPS and add libs for programs to link
1168 if test "$enable_static" = no; then
1169 GLUT_MESA_DEPS='-l$(GLU_LIB) -l$(GL_LIB)'
1171 APP_LIB_DEPS="$APP_LIB_DEPS $GLUT_LIB_DEPS"
1176 AC_SUBST([GLUT_LIB_DEPS])
1177 AC_SUBST([GLUT_MESA_DEPS])
1178 AC_SUBST([GLUT_CFLAGS])
1179 AC_SUBST([GLUT_PC_REQ_PRIV])
1180 AC_SUBST([GLUT_PC_LIB_PRIV])
1181 AC_SUBST([GLUT_PC_CFLAGS])
1184 dnl Program library dependencies
1185 dnl Only libm is added here if necessary as the libraries should
1186 dnl be pulled in by the linker
1188 if test "x$APP_LIB_DEPS" = x; then
1191 APP_LIB_DEPS="-lX11 -lsocket -lnsl -lm"
1194 APP_LIB_DEPS="-lX11"
1201 AC_SUBST([APP_LIB_DEPS])
1202 AC_SUBST([PROGRAM_DIRS])
1205 dnl Gallium configuration
1207 AC_ARG_ENABLE([gallium],
1208 [AS_HELP_STRING([--disable-gallium],
1209 [build gallium @<:@default=enabled@:>@])],
1210 [enable_gallium="$enableval"],
1211 [enable_gallium=yes])
1212 if test "x$enable_gallium" = xyes; then
1213 SRC_DIRS="$SRC_DIRS gallium gallium/winsys gallium/targets"
1214 AC_CHECK_HEADER([udis86.h], [HAS_UDIS86="yes"],
1216 AC_PATH_PROG([LLVM_CONFIG], [llvm-config], [no])
1219 AC_SUBST([LLVM_CFLAGS])
1220 AC_SUBST([LLVM_LIBS])
1221 AC_SUBST([LLVM_LDFLAGS])
1222 AC_SUBST([LLVM_VERSION])
1225 EGL_CLIENT_APIS='$(GL_LIB)'
1226 if test "x$enable_gles_overlay" = xyes; then
1227 EGL_CLIENT_APIS="$EGL_CLIENT_APIS "'$(GLESv1_CM_LIB) $(GLESv2_LIB)'
1231 dnl Gallium state trackers configuration
1233 AC_ARG_WITH([state-trackers],
1234 [AS_HELP_STRING([--with-state-trackers@<:@=DIRS...@:>@],
1235 [comma delimited state_trackers list, e.g.
1236 "egl,glx" @<:@default=auto@:>@])],
1237 [with_state_trackers="$withval"],
1238 [with_state_trackers=yes])
1240 case "$with_state_trackers" in
1242 GALLIUM_STATE_TRACKERS_DIRS=""
1245 # look at what else is built
1246 case "$mesa_driver" in
1248 GALLIUM_STATE_TRACKERS_DIRS=glx
1251 GALLIUM_STATE_TRACKERS_DIRS="dri"
1253 if test "x$enable_egl" = xyes; then
1254 GALLIUM_STATE_TRACKERS_DIRS="$GALLIUM_STATE_TRACKERS_DIRS egl"
1257 # Have only tested st/xorg on 1.6.0 servers
1258 PKG_CHECK_MODULES(XORG, [xorg-server >= 1.6.0 libdrm >= $LIBDRM_XORG_REQUIRED libkms >= $LIBKMS_XORG_REQUIRED],
1259 HAVE_ST_XORG="yes"; GALLIUM_STATE_TRACKERS_DIRS="$GALLIUM_STATE_TRACKERS_DIRS xorg",
1265 # verify the requested state tracker exist
1267 _state_trackers=`IFS=', '; echo $with_state_trackers`
1268 for tracker in $_state_trackers; do
1271 if test "x$mesa_driver" != xdri; then
1272 AC_MSG_ERROR([cannot build dri state tracker without mesa driver set to dri])
1277 if test "x$enable_egl" != xyes; then
1278 AC_MSG_ERROR([cannot build egl state tracker without EGL library])
1283 PKG_CHECK_MODULES([XORG], [xorg-server >= 1.6.0])
1284 PKG_CHECK_MODULES([LIBDRM_XORG], [libdrm >= $LIBDRM_XORG_REQUIRED])
1285 PKG_CHECK_MODULES([LIBKMS_XORG], [libkms >= $LIBKMS_XORG_REQUIRED])
1289 AC_MSG_WARN([state tracker 'es' has been replaced by --enable-gles-overlay])
1291 if test "x$enable_gles_overlay" != xyes; then
1292 if test "x$enable_gles1" != xyes -a "x$enable_gles2" != xyes; then
1293 CORE_DIRS="mapi/es1api mapi/es2api $CORE_DIRS"
1296 EGL_CLIENT_APIS="$EGL_CLIENT_APIS "'$(GLESv1_CM_LIB) $(GLESv2_LIB)'
1301 CORE_DIRS="$CORE_DIRS mapi/vgapi"
1302 VG_LIB_DEPS="$VG_LIB_DEPS -lpthread"
1303 EGL_CLIENT_APIS="$EGL_CLIENT_APIS "'$(VG_LIB)'
1307 if test -n "$tracker"; then
1308 test -d "$srcdir/src/gallium/state_trackers/$tracker" || \
1309 AC_MSG_ERROR([state tracker '$tracker' doesn't exist])
1310 if test -n "$state_trackers"; then
1311 state_trackers="$state_trackers $tracker"
1313 state_trackers="$tracker"
1317 GALLIUM_STATE_TRACKERS_DIRS="$state_trackers"
1321 AC_SUBST([VG_LIB_DEPS])
1322 AC_SUBST([EGL_CLIENT_APIS])
1324 if test "x$HAVE_ST_EGL" = xyes; then
1325 GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS egl"
1326 # define GLX_DIRECT_RENDERING even when the driver is not dri
1327 if test "x$mesa_driver" != xdri -a "x$driglx_direct" = xyes; then
1328 DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
1332 if test "x$HAVE_ST_XORG" = xyes; then
1333 PKG_CHECK_MODULES(XEXT, [xextproto >= 7.0.99.1],
1334 HAVE_XEXTPROTO_71="yes"; DEFINES="$DEFINES -DHAVE_XEXTPROTO_71",
1335 HAVE_XEXTPROTO_71="no")
1338 AC_ARG_WITH([egl-platforms],
1339 [AS_HELP_STRING([--with-egl-platforms@<:@=DIRS...@:>@],
1340 [comma delimited native platforms libEGL supports, e.g.
1341 "x11,kms" @<:@default=auto@:>@])],
1342 [with_egl_platforms="$withval"],
1343 [with_egl_platforms=yes])
1344 AC_ARG_WITH([egl-displays],
1345 [AS_HELP_STRING([--with-egl-displays@<:@=DIRS...@:>@],
1346 [DEPRECATED. Use --with-egl-platforms instead])],
1347 [with_egl_platforms="$withval"])
1350 case "$with_egl_platforms" in
1352 if test "x$enable_egl" = xyes && test "x$mesa_driver" != xosmesa; then
1357 if test "x$enable_egl" != xyes; then
1358 AC_MSG_ERROR([cannot build egl state tracker without EGL library])
1360 # verify the requested driver directories exist
1361 egl_platforms=`IFS=', '; echo $with_egl_platforms`
1362 for plat in $egl_platforms; do
1363 test -d "$srcdir/src/gallium/state_trackers/egl/$plat" || \
1364 AC_MSG_ERROR([EGL platform '$plat' does't exist])
1365 if test "$plat" = "fbdev"; then
1366 GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS sw/fbdev"
1369 EGL_PLATFORMS="$egl_platforms"
1372 AC_SUBST([EGL_PLATFORMS])
1374 AC_ARG_WITH([egl-driver-dir],
1375 [AS_HELP_STRING([--with-egl-driver-dir=DIR],
1376 [directory for EGL drivers [[default=${libdir}/egl]]])],
1377 [EGL_DRIVER_INSTALL_DIR="$withval"],
1378 [EGL_DRIVER_INSTALL_DIR='${libdir}/egl'])
1379 AC_SUBST([EGL_DRIVER_INSTALL_DIR])
1381 AC_ARG_WITH([xorg-driver-dir],
1382 [AS_HELP_STRING([--with-xorg-driver-dir=DIR],
1383 [Default xorg driver directory[[default=${libdir}/xorg/modules/drivers]]])],
1384 [XORG_DRIVER_INSTALL_DIR="$withval"],
1385 [XORG_DRIVER_INSTALL_DIR="${libdir}/xorg/modules/drivers"])
1386 AC_SUBST([XORG_DRIVER_INSTALL_DIR])
1388 AC_ARG_WITH([max-width],
1389 [AS_HELP_STRING([--with-max-width=N],
1390 [Maximum framebuffer width (4096)])],
1391 [DEFINES="${DEFINES} -DMAX_WIDTH=${withval}";
1392 AS_IF([test "${withval}" -gt "4096"],
1393 [AC_MSG_WARN([Large framebuffer: see s_tritemp.h comments.])])]
1395 AC_ARG_WITH([max-height],
1396 [AS_HELP_STRING([--with-max-height=N],
1397 [Maximum framebuffer height (4096)])],
1398 [DEFINES="${DEFINES} -DMAX_HEIGHT=${withval}";
1399 AS_IF([test "${withval}" -gt "4096"],
1400 [AC_MSG_WARN([Large framebuffer: see s_tritemp.h comments.])])]
1406 AC_ARG_ENABLE([gallium-llvm],
1407 [AS_HELP_STRING([--enable-gallium-llvm],
1408 [build gallium LLVM support @<:@default=disabled@:>@])],
1409 [enable_gallium_llvm="$enableval"],
1410 [enable_gallium_llvm=auto])
1411 if test "x$enable_gallium_llvm" = xyes; then
1412 if test "x$LLVM_CONFIG" != xno; then
1413 LLVM_VERSION=`$LLVM_CONFIG --version`
1414 LLVM_CFLAGS=`$LLVM_CONFIG --cflags`
1415 LLVM_LIBS="`$LLVM_CONFIG --libs jit interpreter nativecodegen bitwriter` -lstdc++"
1417 if test "x$HAS_UDIS86" != xno; then
1418 LLVM_LIBS="$LLVM_LIBS -ludis86"
1419 DEFINES="$DEFINES -DHAVE_UDIS86"
1421 LLVM_LDFLAGS=`$LLVM_CONFIG --ldflags`
1422 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS llvmpipe"
1423 DEFINES="$DEFINES -DGALLIUM_LLVMPIPE -D__STDC_CONSTANT_MACROS"
1433 dnl Gallium helper functions
1435 gallium_check_st() {
1436 if test "x$HAVE_ST_DRI" = xyes || test "x$HAVE_ST_XORG" = xyes; then
1437 GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS $1"
1439 if test "x$HAVE_ST_DRI" = xyes && test "x$2" != x; then
1440 GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS $2"
1442 if test "x$HAVE_ST_XORG" = xyes && test "x$3" != x; then
1443 GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS $3"
1449 dnl Gallium SVGA configuration
1451 AC_ARG_ENABLE([gallium-svga],
1452 [AS_HELP_STRING([--enable-gallium-svga],
1453 [build gallium SVGA @<:@default=disabled@:>@])],
1454 [enable_gallium_svga="$enableval"],
1455 [enable_gallium_svga=auto])
1456 if test "x$enable_gallium_svga" = xyes; then
1457 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS svga"
1458 gallium_check_st "svga/drm" "dri-vmwgfx" "xorg-vmwgfx"
1459 elif test "x$enable_gallium_svga" = xauto; then
1460 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS svga"
1464 dnl Gallium i915 configuration
1466 AC_ARG_ENABLE([gallium-i915],
1467 [AS_HELP_STRING([--enable-gallium-i915],
1468 [build gallium i915 @<:@default=disabled@:>@])],
1469 [enable_gallium_i915="$enableval"],
1470 [enable_gallium_i915=auto])
1471 if test "x$enable_gallium_i915" = xyes; then
1472 GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS i915/sw"
1473 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS i915"
1474 gallium_check_st "i915/drm" "dri-i915" "xorg-i915"
1475 elif test "x$enable_gallium_i915" = xauto; then
1476 GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS i915/sw"
1477 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS i915"
1481 dnl Gallium i965 configuration
1483 AC_ARG_ENABLE([gallium-i965],
1484 [AS_HELP_STRING([--enable-gallium-i965],
1485 [build gallium i965 @<:@default=disabled@:>@])],
1486 [enable_gallium_i965="$enableval"],
1487 [enable_gallium_i965=auto])
1488 if test "x$enable_gallium_i965" = xyes; then
1489 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS i965"
1490 gallium_check_st "i965/drm" "dri-i965" "xorg-i965"
1491 elif test "x$enable_gallium_i965" = xauto; then
1492 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS i965"
1496 dnl Gallium Radeon configuration
1498 AC_ARG_ENABLE([gallium-radeon],
1499 [AS_HELP_STRING([--enable-gallium-radeon],
1500 [build gallium radeon @<:@default=disabled@:>@])],
1501 [enable_gallium_radeon="$enableval"],
1502 [enable_gallium_radeon=auto])
1503 if test "x$enable_gallium_radeon" = xyes; then
1504 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r300"
1505 gallium_check_st "radeon/drm" "dri-r300" "xorg-radeon"
1506 elif test "x$enable_gallium_radeon" = xauto; then
1507 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r300"
1511 dnl Gallium Radeon r600g configuration
1513 AC_ARG_ENABLE([gallium-r600],
1514 [AS_HELP_STRING([--enable-gallium-r600],
1515 [build gallium radeon @<:@default=disabled@:>@])],
1516 [enable_gallium_r600="$enableval"],
1517 [enable_gallium_r600=auto])
1518 if test "x$enable_gallium_r600" = xyes; then
1519 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r600"
1520 gallium_check_st "r600/drm" "dri-r600"
1524 dnl Gallium Nouveau configuration
1526 AC_ARG_ENABLE([gallium-nouveau],
1527 [AS_HELP_STRING([--enable-gallium-nouveau],
1528 [build gallium nouveau @<:@default=disabled@:>@])],
1529 [enable_gallium_nouveau="$enableval"],
1530 [enable_gallium_nouveau=no])
1531 if test "x$enable_gallium_nouveau" = xyes; then
1532 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS nouveau nvfx nv50"
1533 gallium_check_st "nouveau/drm" "dri-nouveau" "xorg-nouveau"
1537 dnl Gallium swrast configuration
1539 AC_ARG_ENABLE([gallium-swrast],
1540 [AS_HELP_STRING([--enable-gallium-swrast],
1541 [build gallium swrast @<:@default=auto@:>@])],
1542 [enable_gallium_swrast="$enableval"],
1543 [enable_gallium_swrast=auto])
1544 if test "x$enable_gallium_swrast" = xyes || test "x$enable_gallium_swrast" = xauto; then
1545 if test "x$HAVE_ST_DRI" = xyes; then
1546 GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS dri-swrast"
1550 dnl prepend CORE_DIRS to SRC_DIRS
1551 SRC_DIRS="$CORE_DIRS $SRC_DIRS"
1553 dnl Restore LDFLAGS and CPPFLAGS
1554 LDFLAGS="$_SAVE_LDFLAGS"
1555 CPPFLAGS="$_SAVE_CPPFLAGS"
1557 dnl Substitute the config
1558 AC_CONFIG_FILES([configs/autoconf])
1560 dnl Replace the configs/current symlink
1561 AC_CONFIG_COMMANDS([configs],[
1562 if test -f configs/current || test -L configs/current; then
1563 rm -f configs/current
1565 ln -s autoconf configs/current
1571 dnl Output some configuration info for the user
1574 echo " prefix: $prefix"
1575 echo " exec_prefix: $exec_prefix"
1576 echo " libdir: $libdir"
1577 echo " includedir: $includedir"
1581 echo " Driver: $mesa_driver"
1582 if echo "$DRIVER_DIRS" | grep 'osmesa' >/dev/null 2>&1; then
1583 echo " OSMesa: lib$OSMESA_LIB"
1587 if test "$mesa_driver" = dri; then
1588 # cleanup the drivers var
1589 dri_dirs=`echo $DRI_DIRS | $SED 's/^ *//;s/ */ /;s/ *$//'`
1590 if test "x$DRI_DIRS" = x; then
1591 echo " DRI drivers: no"
1593 echo " DRI drivers: $dri_dirs"
1595 echo " DRI driver dir: $DRI_DRIVER_INSTALL_DIR"
1597 echo " Use XCB: $enable_xcb"
1600 if test "x$MESA_LLVM" = x1; then
1602 echo " llvm-config: $LLVM_CONFIG"
1603 echo " llvm-version: $LLVM_VERSION"
1609 if echo "$SRC_DIRS" | grep 'gallium' >/dev/null 2>&1; then
1610 echo " Gallium: yes"
1611 echo " Gallium dirs: $GALLIUM_DIRS"
1612 echo " Target dirs: $GALLIUM_TARGET_DIRS"
1613 echo " Winsys dirs: $GALLIUM_WINSYS_DIRS"
1614 echo " Driver dirs: $GALLIUM_DRIVERS_DIRS"
1615 echo " Trackers dirs: $GALLIUM_STATE_TRACKERS_DIRS"
1616 if test "x$HAVE_ST_EGL" = xyes; then
1617 echo " EGL client APIs: $EGL_CLIENT_APIS"
1625 echo " Shared libs: $enable_shared"
1626 echo " Static libs: $enable_static"
1627 if test "$enable_egl" = yes; then
1628 echo " EGL: $EGL_DRIVERS_DIRS"
1629 echo " EGL platforms: $EGL_PLATFORMS"
1633 echo " GLU: $enable_glu"
1634 echo " GLw: $enable_glw (Motif: $enable_motif)"
1635 echo " glut: $enable_glut"
1637 dnl Compiler options
1638 # cleanup the CFLAGS/CXXFLAGS/DEFINES vars
1639 cflags=`echo $CFLAGS $OPT_FLAGS $PIC_FLAGS $ARCH_FLAGS | \
1640 $SED 's/^ *//;s/ */ /;s/ *$//'`
1641 cxxflags=`echo $CXXFLAGS $OPT_FLAGS $PIC_FLAGS $ARCH_FLAGS | \
1642 $SED 's/^ *//;s/ */ /;s/ *$//'`
1643 defines=`echo $DEFINES $ASM_FLAGS | $SED 's/^ *//;s/ */ /;s/ *$//'`
1645 echo " CFLAGS: $cflags"
1646 echo " CXXFLAGS: $cxxflags"
1647 echo " Macros: $defines"
1650 echo " Run '${MAKE-make}' to build Mesa"