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.23
22 LIBDRM_RADEON_REQUIRED=2.4.23
23 LIBDRM_INTEL_REQUIRED=2.4.23
24 DRI2PROTO_REQUIRED=2.1
25 GLPROTO_REQUIRED=1.4.11
26 LIBDRM_XORG_REQUIRED=2.4.23
27 LIBKMS_XORG_REQUIRED=1.0.0
33 AC_CHECK_PROGS([MAKE], [gmake make])
34 AC_CHECK_PROGS([PYTHON2], [python2 python])
35 AC_PATH_PROG([MKDEP], [makedepend])
36 AC_PATH_PROG([SED], [sed])
38 if test "x$MKDEP" = "x"; then
39 AC_MSG_ERROR([makedepend is required to build Mesa])
42 dnl Our fallback install-sh is a symlink to minstall. Use the existing
43 dnl configuration in that case.
45 test "x$INSTALL" = "x$ac_install_sh" && INSTALL='$(MINSTALL)'
47 dnl We need a POSIX shell for parts of the build. Assume we have one
51 # Solaris /bin/sh is too old/non-POSIX compliant
52 AC_PATH_PROGS(POSIX_SHELL, [ksh93 ksh sh])
57 dnl clang is mostly GCC-compatible, but its version is much lower,
58 dnl so we have to check for it.
59 AC_MSG_CHECKING([if compiling with clang])
62 [AC_LANG_PROGRAM([], [[
67 [CLANG=yes], [CLANG=no])
69 AC_MSG_RESULT([$CLANG])
71 dnl If we're using GCC, make sure that it is at least version 3.3.0. Older
72 dnl versions are explictly not supported.
73 if test "x$GCC" = xyes -a "x$CLANG" = xno; then
74 AC_MSG_CHECKING([whether gcc version is sufficient])
78 GCC_VERSION=`$CC -dumpversion`
79 if test $? -eq 0; then
80 major=`echo $GCC_VERSION | cut -d. -f1`
81 minor=`echo $GCC_VERSION | cut -d. -f1`
84 if test $major -lt 3 -o $major -eq 3 -a $minor -lt 3 ; then
86 AC_MSG_ERROR([If using GCC, version 3.3.0 or later is required.])
93 MKDEP_OPTIONS=-fdepend
94 dnl Ask gcc where it's keeping its secret headers
95 if test "x$GCC" = xyes; then
96 for dir in include include-fixed; do
97 GCC_INCLUDES=`$CC -print-file-name=$dir`
98 if test "x$GCC_INCLUDES" != x && \
99 test "$GCC_INCLUDES" != "$dir" && \
100 test -d "$GCC_INCLUDES"; then
101 MKDEP_OPTIONS="$MKDEP_OPTIONS -I$GCC_INCLUDES"
105 AC_SUBST([MKDEP_OPTIONS])
107 dnl Make sure the pkg-config macros are defined
108 m4_ifndef([PKG_PROG_PKG_CONFIG],
109 [m4_fatal([Could not locate the pkg-config autoconf macros.
110 These are usually located in /usr/share/aclocal/pkg.m4. If your macros
111 are in a different location, try setting the environment variable
112 ACLOCAL="aclocal -I/other/macro/dir" before running autoreconf.])])
113 PKG_PROG_PKG_CONFIG()
115 dnl LIB_DIR - library basename
116 LIB_DIR=`echo $libdir | $SED 's%.*/%%'`
119 dnl Cache LDFLAGS so we can add EXTRA_LIB_PATH and restore it later
120 _SAVE_LDFLAGS="$LDFLAGS"
121 AC_ARG_VAR([EXTRA_LIB_PATH],[Extra -L paths for the linker])
122 AC_SUBST([EXTRA_LIB_PATH])
124 dnl Cache CPPFLAGS so we can add *_INCLUDES and restore it later
125 _SAVE_CPPFLAGS="$CPPFLAGS"
126 AC_ARG_VAR([X11_INCLUDES],[Extra -I paths for X11 headers])
127 AC_SUBST([X11_INCLUDES])
134 DEFINES="$DEFINES -D_GNU_SOURCE -DPTHREADS"
137 DEFINES="$DEFINES -DPTHREADS -DSVR4"
140 DEFINES="$DEFINES -DPTHREADS"
144 dnl Add flags for gcc and g++
145 if test "x$GCC" = xyes; then
146 CFLAGS="$CFLAGS -Wall -Wmissing-prototypes -std=c99"
147 if test "x$CLANG" = "xno"; then
148 CFLAGS="$CFLAGS -ffast-math"
151 # Enable -fvisibility=hidden if using a gcc that supports it
152 save_CFLAGS="$CFLAGS"
153 AC_MSG_CHECKING([whether $CC supports -fvisibility=hidden])
154 CFLAGS="$CFLAGS -fvisibility=hidden"
155 AC_LINK_IFELSE([AC_LANG_PROGRAM()], AC_MSG_RESULT([yes]),
156 [CFLAGS="$save_CFLAGS" ; AC_MSG_RESULT([no])]);
158 # Work around aliasing bugs - developers should comment this out
159 CFLAGS="$CFLAGS -fno-strict-aliasing"
161 if test "x$GXX" = xyes; then
162 CXXFLAGS="$CXXFLAGS -Wall"
164 # Enable -fvisibility=hidden if using a gcc that supports it
165 save_CXXFLAGS="$CXXFLAGS"
166 AC_MSG_CHECKING([whether $CXX supports -fvisibility=hidden])
167 CXXFLAGS="$CXXFLAGS -fvisibility=hidden"
168 AC_LINK_IFELSE([AC_LANG_PROGRAM()], AC_MSG_RESULT([yes]),
169 [CXXFLAGS="$save_CXXFLAGS" ; AC_MSG_RESULT([no])]);
171 # Work around aliasing bugs - developers should comment this out
172 CXXFLAGS="$CXXFLAGS -fno-strict-aliasing"
175 dnl These should be unnecessary, but let the user set them if they want
176 AC_ARG_VAR([OPT_FLAGS], [Additional optimization flags for the compiler.
177 Default is to use CFLAGS.])
178 AC_ARG_VAR([ARCH_FLAGS], [Additional architecture specific flags for the
179 compiler. Default is to use CFLAGS.])
180 AC_SUBST([OPT_FLAGS])
181 AC_SUBST([ARCH_FLAGS])
184 dnl Hacks to enable 32 or 64 bit build
186 AC_ARG_ENABLE([32-bit],
187 [AS_HELP_STRING([--enable-32-bit],
188 [build 32-bit libraries @<:@default=auto@:>@])],
189 [enable_32bit="$enableval"],
192 if test "x$enable_32bit" = xyes; then
193 if test "x$GCC" = xyes; then
194 CFLAGS="$CFLAGS -m32"
195 ARCH_FLAGS="$ARCH_FLAGS -m32"
197 if test "x$GXX" = xyes; then
198 CXXFLAGS="$CXXFLAGS -m32"
201 AC_ARG_ENABLE([64-bit],
202 [AS_HELP_STRING([--enable-64-bit],
203 [build 64-bit libraries @<:@default=auto@:>@])],
204 [enable_64bit="$enableval"],
207 if test "x$enable_64bit" = xyes; then
208 if test "x$GCC" = xyes; then
209 CFLAGS="$CFLAGS -m64"
211 if test "x$GXX" = xyes; then
212 CXXFLAGS="$CXXFLAGS -m64"
217 dnl shared/static libraries, mimic libtool options
219 AC_ARG_ENABLE([static],
220 [AS_HELP_STRING([--enable-static],
221 [build static libraries @<:@default=disabled@:>@])],
222 [enable_static="$enableval"],
225 case "x$enable_static" in
227 x ) enable_static=no ;;
229 AC_MSG_ERROR([Static library option '$enable_static' is not a valid])
232 AC_ARG_ENABLE([shared],
233 [AS_HELP_STRING([--disable-shared],
234 [build shared libraries @<:@default=enabled@:>@])],
235 [enable_shared="$enableval"],
238 case "x$enable_shared" in
240 x ) enable_shared=yes ;;
242 AC_MSG_ERROR([Shared library option '$enable_shared' is not a valid])
246 dnl Can't have static and shared libraries, default to static if user
247 dnl explicitly requested. If both disabled, set to static since shared
248 dnl was explicitly requirested.
249 case "x$enable_static$enable_shared" in
251 AC_MSG_WARN([Can't build static and shared libraries, disabling shared])
255 AC_MSG_WARN([Can't disable both static and shared libraries, enabling static])
263 AC_ARG_VAR([MKLIB_OPTIONS],[Options for the Mesa library script, mklib])
264 if test "$enable_static" = yes; then
265 MKLIB_OPTIONS="$MKLIB_OPTIONS -static"
267 AC_SUBST([MKLIB_OPTIONS])
270 dnl other compiler options
272 AC_ARG_ENABLE([debug],
273 [AS_HELP_STRING([--enable-debug],
274 [use debug compiler flags and macros @<:@default=disabled@:>@])],
275 [enable_debug="$enableval"],
278 if test "x$enable_debug" = xyes; then
279 DEFINES="$DEFINES -DDEBUG"
280 if test "x$GCC" = xyes; then
283 if test "x$GXX" = xyes; then
284 CXXFLAGS="$CXXFLAGS -g"
291 LIB_PREFIX_GLOB='lib'
292 LIB_VERSION_SEPARATOR='.'
293 if test "$enable_static" = yes; then
298 LIB_EXTENSION='dylib' ;;
300 dnl prefix can be 'cyg' or 'lib'
301 LIB_PREFIX_GLOB='???'
302 LIB_VERSION_SEPARATOR='-'
303 LIB_EXTENSION='dll' ;;
307 LIB_EXTENSION='so' ;;
311 GL_LIB_NAME='lib$(GL_LIB).'${LIB_EXTENSION}
312 GLU_LIB_NAME='lib$(GLU_LIB).'${LIB_EXTENSION}
313 GLUT_LIB_NAME='lib$(GLUT_LIB).'${LIB_EXTENSION}
314 GLW_LIB_NAME='lib$(GLW_LIB).'${LIB_EXTENSION}
315 OSMESA_LIB_NAME='lib$(OSMESA_LIB).'${LIB_EXTENSION}
316 EGL_LIB_NAME='lib$(EGL_LIB).'${LIB_EXTENSION}
317 GLESv1_CM_LIB_NAME='lib$(GLESv1_CM_LIB).'${LIB_EXTENSION}
318 GLESv2_LIB_NAME='lib$(GLESv2_LIB).'${LIB_EXTENSION}
319 VG_LIB_NAME='lib$(VG_LIB).'${LIB_EXTENSION}
320 GLAPI_LIB_NAME='lib$(GLAPI_LIB).'${LIB_EXTENSION}
322 GL_LIB_GLOB=${LIB_PREFIX_GLOB}'$(GL_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
323 GLU_LIB_GLOB=${LIB_PREFIX_GLOB}'$(GLU_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
324 GLUT_LIB_GLOB=${LIB_PREFIX_GLOB}'$(GLUT_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
325 GLW_LIB_GLOB=${LIB_PREFIX_GLOB}'$(GLW_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
326 OSMESA_LIB_GLOB=${LIB_PREFIX_GLOB}'$(OSMESA_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
327 EGL_LIB_GLOB=${LIB_PREFIX_GLOB}'$(EGL_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
328 EGL_LIB_GLOB=${LIB_PREFIX_GLOB}'$(EGL_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
329 GLESv1_CM_LIB_GLOB=${LIB_PREFIX_GLOB}'$(GLESv1_CM_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
330 GLESv2_LIB_GLOB=${LIB_PREFIX_GLOB}'$(GLESv2_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
331 VG_LIB_GLOB=${LIB_PREFIX_GLOB}'$(VG_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
332 GLAPI_LIB_GLOB=${LIB_PREFIX_GLOB}'$(GLAPI_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
334 AC_SUBST([GL_LIB_NAME])
335 AC_SUBST([GLU_LIB_NAME])
336 AC_SUBST([GLUT_LIB_NAME])
337 AC_SUBST([GLW_LIB_NAME])
338 AC_SUBST([OSMESA_LIB_NAME])
339 AC_SUBST([EGL_LIB_NAME])
340 AC_SUBST([GLESv1_CM_LIB_NAME])
341 AC_SUBST([GLESv2_LIB_NAME])
342 AC_SUBST([VG_LIB_NAME])
343 AC_SUBST([GLAPI_LIB_NAME])
345 AC_SUBST([GL_LIB_GLOB])
346 AC_SUBST([GLU_LIB_GLOB])
347 AC_SUBST([GLUT_LIB_GLOB])
348 AC_SUBST([GLW_LIB_GLOB])
349 AC_SUBST([OSMESA_LIB_GLOB])
350 AC_SUBST([EGL_LIB_GLOB])
351 AC_SUBST([GLESv1_CM_LIB_GLOB])
352 AC_SUBST([GLESv2_LIB_GLOB])
353 AC_SUBST([VG_LIB_GLOB])
354 AC_SUBST([GLAPI_LIB_GLOB])
357 dnl Arch/platform-specific settings
360 [AS_HELP_STRING([--disable-asm],
361 [disable assembly usage @<:@default=enabled on supported plaforms@:>@])],
362 [enable_asm="$enableval"],
369 AC_MSG_CHECKING([whether to enable assembly])
370 test "x$enable_asm" = xno && AC_MSG_RESULT([no])
371 # disable if cross compiling on x86/x86_64 since we must run gen_matypes
372 if test "x$enable_asm" = xyes && test "x$cross_compiling" = xyes; then
376 AC_MSG_RESULT([no, cross compiling])
380 # check for supported arches
381 if test "x$enable_asm" = xyes; then
385 linux* | *freebsd* | dragonfly* | *netbsd*)
386 test "x$enable_64bit" = xyes && asm_arch=x86_64 || asm_arch=x86
392 linux* | *freebsd* | dragonfly* | *netbsd*)
393 test "x$enable_32bit" = xyes && asm_arch=x86 || asm_arch=x86_64
415 ASM_FLAGS="-DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM"
416 MESA_ASM_SOURCES='$(X86_SOURCES)'
417 GLAPI_ASM_SOURCES='$(X86_API)'
418 AC_MSG_RESULT([yes, x86])
421 ASM_FLAGS="-DUSE_X86_64_ASM"
422 MESA_ASM_SOURCES='$(X86-64_SOURCES)'
423 GLAPI_ASM_SOURCES='$(X86-64_API)'
424 AC_MSG_RESULT([yes, x86_64])
427 ASM_FLAGS="-DUSE_PPC_ASM -DUSE_VMX_ASM"
428 MESA_ASM_SOURCES='$(PPC_SOURCES)'
429 AC_MSG_RESULT([yes, ppc])
432 ASM_FLAGS="-DUSE_SPARC_ASM"
433 MESA_ASM_SOURCES='$(SPARC_SOURCES)'
434 GLAPI_ASM_SOURCES='$(SPARC_API)'
435 AC_MSG_RESULT([yes, sparc])
438 AC_MSG_RESULT([no, platform not supported])
442 AC_SUBST([ASM_FLAGS])
443 AC_SUBST([MESA_ASM_SOURCES])
444 AC_SUBST([GLAPI_ASM_SOURCES])
449 dnl Check to see if dlopen is in default libraries (like Solaris, which
450 dnl has it in libc), or if libdl is needed to get it.
451 AC_CHECK_FUNC([dlopen], [],
452 [AC_CHECK_LIB([dl], [dlopen], [DLOPEN_LIBS="-ldl"])])
453 AC_SUBST([DLOPEN_LIBS])
455 dnl See if posix_memalign is available
456 AC_CHECK_FUNC([posix_memalign], [DEFINES="$DEFINES -DHAVE_POSIX_MEMALIGN"])
458 dnl SELinux awareness.
459 AC_ARG_ENABLE([selinux],
460 [AS_HELP_STRING([--enable-selinux],
461 [Build SELinux-aware Mesa @<:@default=disabled@:>@])],
462 [MESA_SELINUX="$enableval"],
464 if test "x$enable_selinux" = "xyes"; then
465 AC_CHECK_HEADER([selinux/selinux.h],[],
466 [AC_MSG_ERROR([SELinux headers not found])])
467 AC_CHECK_LIB([selinux],[is_selinux_enabled],[],
468 [AC_MSG_ERROR([SELinux library not found])])
469 SELINUX_LIBS="-lselinux"
470 DEFINES="$DEFINES -DMESA_SELINUX"
473 dnl Determine which APIs to support
474 AC_ARG_ENABLE([opengl],
475 [AS_HELP_STRING([--disable-opengl],
476 [disable support for standard OpenGL API @<:@default=no@:>@])],
477 [enable_opengl="$enableval"],
479 AC_ARG_ENABLE([gles1],
480 [AS_HELP_STRING([--enable-gles1],
481 [enable support for OpenGL ES 1.x API @<:@default=no@:>@])],
482 [enable_gles1="$enableval"],
484 AC_ARG_ENABLE([gles2],
485 [AS_HELP_STRING([--enable-gles2],
486 [enable support for OpenGL ES 2.x API @<:@default=no@:>@])],
487 [enable_gles2="$enableval"],
489 AC_ARG_ENABLE([gles-overlay],
490 [AS_HELP_STRING([--enable-gles-overlay],
491 [DEPRECATED. Same as --enable-gles1 and --enable-gles2])],
492 [enable_gles1="$enableval"; enable_gles2="$enableval"],
495 AC_ARG_ENABLE([openvg],
496 [AS_HELP_STRING([--enable-openvg],
497 [enable support for OpenVG API @<:@default=no@:>@])],
498 [enable_openvg="$enableval"],
501 dnl smooth the transition; should be removed eventually
502 if test "x$enable_openvg" = xno; then
503 case "x$with_state_trackers" in
505 AC_MSG_WARN([vega state tracker is enabled without --enable-openvg])
511 if test "x$enable_opengl" = xno -a \
512 "x$enable_gles1" = xno -a \
513 "x$enable_gles2" = xno -a \
514 "x$enable_openvg" = xno; then
515 AC_MSG_ERROR([at least one API should be enabled])
519 if test "x$enable_opengl" = xno; then
520 API_DEFINES="$API_DEFINES -DFEATURE_GL=0"
522 API_DEFINES="$API_DEFINES -DFEATURE_GL=1"
524 if test "x$enable_gles1" = xyes; then
525 API_DEFINES="$API_DEFINES -DFEATURE_ES1=1"
527 if test "x$enable_gles2" = xyes; then
528 API_DEFINES="$API_DEFINES -DFEATURE_ES2=1"
530 AC_SUBST([API_DEFINES])
532 AC_ARG_ENABLE([shared-glapi],
533 [AS_HELP_STRING([--enable-shared-glapi],
534 [EXPERIMENTAL. Enable shared glapi for OpenGL @<:@default=no@:>@])],
535 [enable_shared_glapi="$enableval"],
536 [enable_shared_glapi=no])
539 if test "x$enable_shared_glapi" = xyes; then
542 AC_SUBST([SHARED_GLAPI])
545 dnl Driver configuration. Options are xlib, dri and osmesa right now.
546 dnl More later: fbdev, ...
548 default_driver="xlib"
553 i*86|x86_64|powerpc*|sparc*) default_driver="dri";;
556 *freebsd* | dragonfly* | *netbsd*)
558 i*86|x86_64|powerpc*|sparc*) default_driver="dri";;
563 if test "x$enable_opengl" = xno; then
567 AC_ARG_WITH([driver],
568 [AS_HELP_STRING([--with-driver=DRIVER],
569 [driver for Mesa: xlib,dri,osmesa @<:@default=dri when available, or xlib@:>@])],
570 [mesa_driver="$withval"],
571 [mesa_driver="$default_driver"])
572 dnl Check for valid option
573 case "x$mesa_driver" in
575 if test "x$enable_opengl" = xno; then
576 AC_MSG_ERROR([Driver '$mesa_driver' requires OpenGL enabled])
582 AC_MSG_ERROR([Driver '$mesa_driver' is not a valid option])
586 PKG_CHECK_MODULES([TALLOC], [talloc])
587 AC_SUBST([TALLOC_LIBS])
588 AC_SUBST([TALLOC_CFLAGS])
591 dnl Driver specific build directories
594 dnl this variable will be prepended to SRC_DIRS and is not exported
599 GALLIUM_DIRS="auxiliary drivers state_trackers"
600 GALLIUM_TARGET_DIRS=""
601 GALLIUM_WINSYS_DIRS="sw"
602 GALLIUM_DRIVERS_DIRS="softpipe failover galahad trace rbug noop identity"
603 GALLIUM_STATE_TRACKERS_DIRS=""
605 # build shared-glapi if enabled for OpenGL or if OpenGL ES is enabled
606 case "x$enabled_shared_glapi$enable_gles1$enable_gles2" in
608 CORE_DIRS="$CORE_DIRS mapi/shared-glapi"
612 # build glapi if OpenGL is enabled
613 if test "x$enable_opengl" = xyes; then
614 CORE_DIRS="$CORE_DIRS mapi/glapi"
617 # build es1api if OpenGL ES 1.x is enabled
618 if test "x$enable_gles1" = xyes; then
619 CORE_DIRS="$CORE_DIRS mapi/es1api"
622 # build es2api if OpenGL ES 2.x is enabled
623 if test "x$enable_gles2" = xyes; then
624 CORE_DIRS="$CORE_DIRS mapi/es2api"
627 # build vgapi if OpenVG is enabled
628 if test "x$enable_openvg" = xyes; then
629 CORE_DIRS="$CORE_DIRS mapi/vgapi"
632 # build glsl and mesa if OpenGL or OpenGL ES is enabled
633 case "x$enable_opengl$enable_gles1$enable_gles2" in
635 CORE_DIRS="$CORE_DIRS glsl mesa"
639 case "$mesa_driver" in
642 GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS sw/xlib"
643 GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS libgl-xlib"
646 SRC_DIRS="$SRC_DIRS glx"
648 GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS sw/xlib sw/dri"
659 AC_SUBST([DRIVER_DIRS])
660 AC_SUBST([GALLIUM_DIRS])
661 AC_SUBST([GALLIUM_TARGET_DIRS])
662 AC_SUBST([GALLIUM_WINSYS_DIRS])
663 AC_SUBST([GALLIUM_DRIVERS_DIRS])
664 AC_SUBST([GALLIUM_STATE_TRACKERS_DIRS])
665 AC_SUBST([MESA_LLVM])
668 dnl Find out if X is available. The variable have_x is set if libX11 is
669 dnl found to mimic AC_PATH_XTRA.
671 if test -n "$PKG_CONFIG"; then
672 AC_MSG_CHECKING([pkg-config files for X11 are available])
673 PKG_CHECK_EXISTS([x11],[
679 AC_MSG_RESULT([$x11_pkgconfig])
683 dnl Use the autoconf macro if no pkg-config files
684 if test "$x11_pkgconfig" = yes; then
685 PKG_CHECK_MODULES([X11], [x11])
688 test -z "$X11_CFLAGS" && X11_CFLAGS="$X_CFLAGS"
689 test -z "$X11_LIBS" && X11_LIBS="$X_LIBS -lX11"
690 AC_SUBST([X11_CFLAGS])
694 dnl Try to tell the user that the --x-* options are only used when
695 dnl pkg-config is not available. This must be right after AC_PATH_XTRA.
696 m4_divert_once([HELP_BEGIN],
697 [These options are only used when the X libraries cannot be found by the
698 pkg-config utility.])
700 dnl We need X for xlib and dri, so bomb now if it's not found
701 case "$mesa_driver" in
703 if test "$no_x" = yes; then
704 AC_MSG_ERROR([X11 development libraries needed for $mesa_driver driver])
709 dnl XCB - this is only used for GLX right now
711 [AS_HELP_STRING([--enable-xcb],
712 [use XCB for GLX @<:@default=disabled@:>@])],
713 [enable_xcb="$enableval"],
715 if test "x$enable_xcb" = xyes; then
716 DEFINES="$DEFINES -DUSE_XCB"
722 dnl libGL configuration per driver
724 case "$mesa_driver" in
726 if test "$x11_pkgconfig" = yes; then
727 PKG_CHECK_MODULES([XLIBGL], [x11 xext])
728 GL_PC_REQ_PRIV="x11 xext"
729 X11_INCLUDES="$X11_INCLUDES $XLIBGL_CFLAGS"
730 GL_LIB_DEPS="$XLIBGL_LIBS"
732 # should check these...
733 X11_INCLUDES="$X11_INCLUDES $X_CFLAGS"
734 GL_LIB_DEPS="$X_LIBS -lX11 -lXext"
735 GL_PC_LIB_PRIV="$GL_LIB_DEPS"
736 GL_PC_CFLAGS="$X11_INCLUDES"
738 GL_LIB_DEPS="$GL_LIB_DEPS $SELINUX_LIBS -lm -lpthread $TALLOC_LIBS"
739 GL_PC_LIB_PRIV="$GL_PC_LIB_PRIV $SELINUX_LIBS -lm -lpthread $TALLOC_LIBS"
741 # if static, move the external libraries to the programs
742 # and empty the libraries for libGL
743 if test "$enable_static" = yes; then
744 APP_LIB_DEPS="$APP_LIB_DEPS $GL_LIB_DEPS"
748 dri|no) # these checks are still desired when there is no mesa_driver
749 # DRI must be shared, I think
750 if test "$enable_static" = yes; then
751 AC_MSG_ERROR([Can't use static libraries for DRI drivers])
755 PKG_CHECK_MODULES([LIBDRM], [libdrm >= $LIBDRM_REQUIRED])
756 PKG_CHECK_MODULES([DRI2PROTO], [dri2proto >= $DRI2PROTO_REQUIRED])
757 PKG_CHECK_MODULES([GLPROTO], [glproto >= $GLPROTO_REQUIRED])
758 GL_PC_REQ_PRIV="libdrm >= $LIBDRM_REQUIRED dri2proto >= $DRI2PROTO_REQUIRED glproto >= $GLPROTO_REQUIRED"
759 DRI_PC_REQ_PRIV="libdrm >= $LIBDRM_REQUIRED"
761 # find the DRI deps for libGL
762 if test "$x11_pkgconfig" = yes; then
763 dri_modules="x11 xext xdamage xfixes"
765 # add xf86vidmode if available
766 PKG_CHECK_MODULES([XF86VIDMODE], [xxf86vm], HAVE_XF86VIDMODE=yes, HAVE_XF86VIDMODE=no)
767 if test "$HAVE_XF86VIDMODE" = yes ; then
768 dri_modules="$dri_modules xxf86vm"
771 # add xcb modules if necessary
772 if test "$enable_xcb" = yes; then
773 dri_modules="$dri_modules x11-xcb xcb-glx"
776 PKG_CHECK_MODULES([DRIGL], [$dri_modules])
777 GL_PC_REQ_PRIV="$GL_PC_REQ_PRIV $dri_modules"
778 X11_INCLUDES="$X11_INCLUDES $DRIGL_CFLAGS"
779 GL_LIB_DEPS="$DRIGL_LIBS"
781 # should check these...
782 X11_INCLUDES="$X11_INCLUDES $X_CFLAGS"
783 GL_LIB_DEPS="$X_LIBS -lX11 -lXext -lXxf86vm -lXdamage -lXfixes"
784 GL_PC_LIB_PRIV="$GL_LIB_DEPS"
785 GL_PC_CFLAGS="$X11_INCLUDES"
787 # XCB can only be used from pkg-config
788 if test "$enable_xcb" = yes; then
789 PKG_CHECK_MODULES([XCB],[x11-xcb xcb-glx])
790 GL_PC_REQ_PRIV="$GL_PC_REQ_PRIV x11-xcb xcb-glx"
791 X11_INCLUDES="$X11_INCLUDES $XCB_CFLAGS"
792 GL_LIB_DEPS="$GL_LIB_DEPS $XCB_LIBS"
796 # need DRM libs, -lpthread, etc.
797 GL_LIB_DEPS="$GL_LIB_DEPS $LIBDRM_LIBS -lm -lpthread $DLOPEN_LIBS"
798 GL_PC_LIB_PRIV="-lm -lpthread $DLOPEN_LIBS"
799 GLESv1_CM_LIB_DEPS="$LIBDRM_LIBS -lm -lpthread $DLOPEN_LIBS"
800 GLESv1_CM_PC_LIB_PRIV="-lm -lpthread $DLOPEN_LIBS"
801 GLESv2_LIB_DEPS="$LIBDRM_LIBS -lm -lpthread $DLOPEN_LIBS"
802 GLESv2_PC_LIB_PRIV="-lm -lpthread $DLOPEN_LIBS"
805 # No libGL for osmesa
809 AC_SUBST([GL_LIB_DEPS])
810 AC_SUBST([GL_PC_REQ_PRIV])
811 AC_SUBST([GL_PC_LIB_PRIV])
812 AC_SUBST([GL_PC_CFLAGS])
813 AC_SUBST([DRI_PC_REQ_PRIV])
814 AC_SUBST([GLESv1_CM_LIB_DEPS])
815 AC_SUBST([GLESv1_CM_PC_LIB_PRIV])
816 AC_SUBST([GLESv2_LIB_DEPS])
817 AC_SUBST([GLESv2_PC_LIB_PRIV])
819 GLAPI_LIB_DEPS="-lpthread"
820 AC_SUBST([GLAPI_LIB_DEPS])
822 AC_SUBST([HAVE_XF86VIDMODE])
824 PKG_CHECK_MODULES([LIBDRM_RADEON],
825 [libdrm_radeon libdrm >= $LIBDRM_RADEON_REQUIRED],
826 HAVE_LIBDRM_RADEON=yes,
827 HAVE_LIBDRM_RADEON=no)
832 if test "$mesa_driver" = xlib; then
833 DEFINES="$DEFINES -DUSE_XSHM"
840 AC_ARG_ENABLE([glx-tls],
841 [AS_HELP_STRING([--enable-glx-tls],
842 [enable TLS support in GLX @<:@default=disabled@:>@])],
843 [GLX_USE_TLS="$enableval"],
845 AC_SUBST(GLX_TLS, ${GLX_USE_TLS})
850 dnl Directory for DRI drivers
851 AC_ARG_WITH([dri-driverdir],
852 [AS_HELP_STRING([--with-dri-driverdir=DIR],
853 [directory for the DRI drivers @<:@${libdir}/dri@:>@])],
854 [DRI_DRIVER_INSTALL_DIR="$withval"],
855 [DRI_DRIVER_INSTALL_DIR='${libdir}/dri'])
856 AC_SUBST([DRI_DRIVER_INSTALL_DIR])
857 dnl Extra search path for DRI drivers
858 AC_ARG_WITH([dri-searchpath],
859 [AS_HELP_STRING([--with-dri-searchpath=DIRS...],
860 [semicolon delimited DRI driver search directories @<:@${libdir}/dri@:>@])],
861 [DRI_DRIVER_SEARCH_DIR="$withval"],
862 [DRI_DRIVER_SEARCH_DIR='${DRI_DRIVER_INSTALL_DIR}'])
863 AC_SUBST([DRI_DRIVER_SEARCH_DIR])
864 dnl Direct rendering or just indirect rendering
865 AC_ARG_ENABLE([driglx-direct],
866 [AS_HELP_STRING([--disable-driglx-direct],
867 [enable direct rendering in GLX and EGL for DRI @<:@default=enabled@:>@])],
868 [driglx_direct="$enableval"],
869 [driglx_direct="yes"])
870 dnl Which drivers to build - default is chosen by platform
871 AC_ARG_WITH([dri-drivers],
872 [AS_HELP_STRING([--with-dri-drivers@<:@=DIRS...@:>@],
873 [comma delimited DRI drivers list, e.g.
874 "swrast,i965,radeon" @<:@default=auto@:>@])],
875 [with_dri_drivers="$withval"],
876 [with_dri_drivers=yes])
877 if test "x$with_dri_drivers" = x; then
881 dnl If $with_dri_drivers is yes, directories will be added through
884 case "$with_dri_drivers" in
890 # verify the requested driver directories exist
891 dri_drivers=`IFS=', '; echo $with_dri_drivers`
892 for driver in $dri_drivers; do
893 test -d "$srcdir/src/mesa/drivers/dri/$driver" || \
894 AC_MSG_ERROR([DRI driver directory '$driver' doesn't exist])
896 DRI_DIRS="$dri_drivers"
900 dnl Set DRI_DIRS, DEFINES and LIB_DEPS
901 if test "$mesa_driver" = dri -o "$mesa_driver" = no; then
903 if test "x$GLX_USE_TLS" = xyes; then
904 DEFINES="$DEFINES -DGLX_USE_TLS -DPTHREADS"
907 # Platform specific settings and drivers to build
910 DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
911 if test "x$driglx_direct" = xyes; then
912 DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
914 DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING -DHAVE_ALIAS"
918 # sis is missing because they have not be converted to use
919 # the new interface. i810 are missing because there is no
920 # x86-64 system where they could *ever* be used.
921 if test "x$DRI_DIRS" = "xyes"; then
922 DRI_DIRS="i915 i965 mach64 mga r128 r200 r300 r600 radeon \
923 savage tdfx unichrome swrast"
927 # Build only the drivers for cards that exist on PowerPC.
928 # At some point MGA will be added, but not yet.
929 if test "x$DRI_DIRS" = "xyes"; then
930 DRI_DIRS="mach64 r128 r200 r300 r600 radeon tdfx swrast"
934 # Build only the drivers for cards that exist on sparc`
935 if test "x$DRI_DIRS" = "xyes"; then
936 DRI_DIRS="mach64 r128 r200 r300 r600 radeon swrast"
941 freebsd* | dragonfly* | *netbsd*)
942 DEFINES="$DEFINES -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1"
943 DEFINES="$DEFINES -DIN_DRI_DRIVER -DHAVE_ALIAS"
944 DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING"
945 if test "x$driglx_direct" = xyes; then
946 DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
949 if test "x$DRI_DIRS" = "xyes"; then
950 DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 r600 radeon tdfx \
951 unichrome savage sis swrast"
955 DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
956 DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING -DHAVE_ALIAS"
959 DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
960 DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING"
961 if test "x$driglx_direct" = xyes; then
962 DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
968 if test "x$DRI_DIRS" = "xyes"; then
969 DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 r600 radeon \
970 savage sis tdfx unichrome swrast"
973 DRI_DIRS=`echo "$DRI_DIRS" | $SED 's/ */ /g'`
976 if test "$mesa_driver" = dri; then
980 [AS_HELP_STRING([--with-expat=DIR],
981 [expat install directory])],[
982 EXPAT_INCLUDES="-I$withval/include"
983 CPPFLAGS="$CPPFLAGS $EXPAT_INCLUDES"
984 LDFLAGS="$LDFLAGS -L$withval/$LIB_DIR"
985 EXPAT_LIB="-L$withval/$LIB_DIR -lexpat"
987 AC_CHECK_HEADER([expat.h],[],[AC_MSG_ERROR([Expat required for DRI.])])
988 AC_CHECK_LIB([expat],[XML_ParserCreate],[],
989 [AC_MSG_ERROR([Expat required for DRI.])])
992 # put all the necessary libs together
993 DRI_LIB_DEPS="$SELINUX_LIBS $LIBDRM_LIBS $EXPAT_LIB -lm -lpthread $DLOPEN_LIBS $TALLOC_LIBS"
996 AC_SUBST([EXPAT_INCLUDES])
997 AC_SUBST([DRI_LIB_DEPS])
1001 PKG_CHECK_MODULES([INTEL], [libdrm_intel >= $LIBDRM_INTEL_REQUIRED])
1006 *radeon*|*r200*|*r300*|*r600*)
1007 if test "x$HAVE_LIBDRM_RADEON" = xyes; then
1008 RADEON_CFLAGS="-DHAVE_LIBDRM_RADEON=1 $LIBDRM_RADEON_CFLAGS"
1009 RADEON_LDFLAGS=$LIBDRM_RADEON_LIBS
1013 AC_SUBST([RADEON_CFLAGS])
1014 AC_SUBST([RADEON_LDFLAGS])
1018 dnl OSMesa configuration
1020 if test "$mesa_driver" = xlib; then
1021 default_gl_osmesa=yes
1023 default_gl_osmesa=no
1025 AC_ARG_ENABLE([gl-osmesa],
1026 [AS_HELP_STRING([--enable-gl-osmesa],
1027 [enable OSMesa with libGL @<:@default=enabled for xlib driver@:>@])],
1028 [gl_osmesa="$enableval"],
1029 [gl_osmesa="$default_gl_osmesa"])
1030 if test "x$gl_osmesa" = xyes; then
1031 if test "x$enable_opengl" = xno; then
1032 AC_MSG_ERROR([OpenGL is not available for OSMesa driver])
1034 if test "$mesa_driver" = osmesa; then
1035 AC_MSG_ERROR([libGL is not available for OSMesa driver])
1037 DRIVER_DIRS="$DRIVER_DIRS osmesa"
1041 dnl Configure the channel bits for OSMesa (libOSMesa, libOSMesa16, ...)
1042 AC_ARG_WITH([osmesa-bits],
1043 [AS_HELP_STRING([--with-osmesa-bits=BITS],
1044 [OSMesa channel bits and library name: 8, 16, 32 @<:@default=8@:>@])],
1045 [osmesa_bits="$withval"],
1047 if test "$mesa_driver" != osmesa && test "x$osmesa_bits" != x8; then
1048 AC_MSG_WARN([Ignoring OSMesa channel bits for non-OSMesa driver])
1051 case "x$osmesa_bits" in
1056 OSMESA_LIB="OSMesa$osmesa_bits"
1057 DEFINES="$DEFINES -DCHAN_BITS=$osmesa_bits -DDEFAULT_SOFTWARE_DEPTH_BITS=31"
1060 AC_MSG_ERROR([OSMesa bits '$osmesa_bits' is not a valid option])
1063 AC_SUBST([OSMESA_LIB])
1065 case "$DRIVER_DIRS" in
1067 # only link libraries with osmesa if shared
1068 if test "$enable_static" = no; then
1069 OSMESA_LIB_DEPS="-lm -lpthread $SELINUX_LIBS $DLOPEN_LIBS $TALLOC_LIBS"
1074 OSMESA_PC_LIB_PRIV="-lm -lpthread $SELINUX_LIBS $DLOPEN_LIBS $TALLOC_LIBS"
1077 AC_SUBST([OSMESA_LIB_DEPS])
1078 AC_SUBST([OSMESA_MESA_DEPS])
1079 AC_SUBST([OSMESA_PC_REQ])
1080 AC_SUBST([OSMESA_PC_LIB_PRIV])
1083 dnl EGL configuration
1085 AC_ARG_ENABLE([egl],
1086 [AS_HELP_STRING([--disable-egl],
1087 [disable EGL library @<:@default=enabled@:>@])],
1088 [enable_egl="$enableval"],
1090 if test "x$enable_egl" = xno; then
1091 if test "x$mesa_driver" = xno; then
1092 AC_MSG_ERROR([cannot disable EGL when there is no mesa driver])
1094 if test "x$enable_openvg" = xyes; then
1095 AC_MSG_ERROR([cannot enable OpenVG without EGL])
1098 if test "x$enable_egl" = xyes; then
1099 SRC_DIRS="$SRC_DIRS egl"
1100 EGL_LIB_DEPS="$DLOPEN_LIBS -lpthread"
1102 if test "$enable_static" != yes; then
1103 # build egl_glx when libGL is built
1104 if test "$mesa_driver" = xlib -o "$mesa_driver" = dri; then
1105 EGL_DRIVERS_DIRS="glx"
1108 if test "$mesa_driver" = dri; then
1109 # build egl_dri2 when xcb-dri2 is available
1110 PKG_CHECK_MODULES([XCB_DRI2], [x11-xcb xcb-dri2 xcb-xfixes],
1111 [have_xcb_dri2=yes],[have_xcb_dri2=no])
1112 PKG_CHECK_MODULES([LIBUDEV], [libudev > 150],
1113 [have_libudev=yes],[have_libudev=no])
1115 if test "$have_xcb_dri2" = yes; then
1116 EGL_DRIVER_DRI2=dri2
1117 DEFINES="$DEFINES -DHAVE_XCB_DRI2"
1118 if test "$have_libudev" = yes; then
1119 DEFINES="$DEFINES -DHAVE_LIBUDEV"
1124 EGL_DRIVERS_DIRS="$EGL_DRIVERS_DIRS $EGL_DRIVER_DRI2"
1127 AC_SUBST([EGL_LIB_DEPS])
1128 AC_SUBST([EGL_DRIVERS_DIRS])
1131 dnl GLU configuration
1133 AC_ARG_ENABLE([glu],
1134 [AS_HELP_STRING([--disable-glu],
1135 [enable OpenGL Utility library @<:@default=enabled@:>@])],
1136 [enable_glu="$enableval"],
1139 if test "x$enable_glu" = xyes -a "x$mesa_driver" = xno; then
1140 AC_MSG_NOTICE([Disabling GLU since there is no OpenGL driver])
1144 if test "x$enable_glu" = xyes; then
1145 SRC_DIRS="$SRC_DIRS glu"
1147 case "$mesa_driver" in
1149 # Link libGLU to libOSMesa instead of libGL
1152 if test "$enable_static" = no; then
1153 GLU_MESA_DEPS='-l$(OSMESA_LIB)'
1159 # If static, empty GLU_LIB_DEPS and add libs for programs to link
1161 GLU_PC_LIB_PRIV="-lm"
1162 if test "$enable_static" = no; then
1164 GLU_MESA_DEPS='-l$(GL_LIB)'
1168 APP_LIB_DEPS="$APP_LIB_DEPS -lstdc++"
1173 if test "$enable_static" = no; then
1174 GLU_LIB_DEPS="$GLU_LIB_DEPS $OS_CPLUSPLUS_LIBS"
1176 GLU_PC_LIB_PRIV="$GLU_PC_LIB_PRIV $OS_CPLUSPLUS_LIBS"
1177 AC_SUBST([GLU_LIB_DEPS])
1178 AC_SUBST([GLU_MESA_DEPS])
1179 AC_SUBST([GLU_PC_REQ])
1180 AC_SUBST([GLU_PC_REQ_PRIV])
1181 AC_SUBST([GLU_PC_LIB_PRIV])
1182 AC_SUBST([GLU_PC_CFLAGS])
1185 dnl GLw configuration
1187 AC_ARG_ENABLE([glw],
1188 [AS_HELP_STRING([--disable-glw],
1189 [enable Xt/Motif widget library @<:@default=enabled@:>@])],
1190 [enable_glw="$enableval"],
1192 dnl Don't build GLw on osmesa
1193 if test "x$enable_glw" = xyes; then
1194 case "$mesa_driver" in
1196 AC_MSG_NOTICE([Disabling GLw since there is no OpenGL driver])
1201 AC_ARG_ENABLE([motif],
1202 [AS_HELP_STRING([--enable-motif],
1203 [use Motif widgets in GLw @<:@default=disabled@:>@])],
1204 [enable_motif="$enableval"],
1207 if test "x$enable_glw" = xyes; then
1208 SRC_DIRS="$SRC_DIRS glw"
1209 if test "$x11_pkgconfig" = yes; then
1210 PKG_CHECK_MODULES([GLW],[x11 xt])
1211 GLW_PC_REQ_PRIV="x11 xt"
1212 GLW_LIB_DEPS="$GLW_LIBS"
1214 # should check these...
1215 GLW_LIB_DEPS="$X_LIBS -lXt -lX11"
1216 GLW_PC_LIB_PRIV="$GLW_LIB_DEPS"
1217 GLW_PC_CFLAGS="$X11_INCLUDES"
1220 GLW_SOURCES="GLwDrawA.c"
1222 if test "x$enable_motif" = xyes; then
1223 GLW_SOURCES="$GLW_SOURCES GLwMDrawA.c"
1224 AC_PATH_PROG([MOTIF_CONFIG], [motif-config], [no])
1225 if test "x$MOTIF_CONFIG" != xno; then
1226 MOTIF_CFLAGS=`$MOTIF_CONFIG --cflags`
1227 MOTIF_LIBS=`$MOTIF_CONFIG --libs`
1229 AC_CHECK_HEADER([Xm/PrimitiveP.h], [],
1230 [AC_MSG_ERROR([Can't locate Motif headers])])
1231 AC_CHECK_LIB([Xm], [XmGetPixmap], [MOTIF_LIBS="-lXm"],
1232 [AC_MSG_ERROR([Can't locate Motif Xm library])])
1234 # MOTIF_LIBS is prepended to GLW_LIB_DEPS since Xm needs Xt/X11
1235 GLW_LIB_DEPS="$MOTIF_LIBS $GLW_LIB_DEPS"
1236 GLW_PC_LIB_PRIV="$MOTIF_LIBS $GLW_PC_LIB_PRIV"
1237 GLW_PC_CFLAGS="$MOTIF_CFLAGS $GLW_PC_CFLAGS"
1240 # If static, empty GLW_LIB_DEPS and add libs for programs to link
1241 GLW_PC_LIB_PRIV="$GLW_PC_LIB_PRIV"
1242 if test "$enable_static" = no; then
1243 GLW_MESA_DEPS='-l$(GL_LIB)'
1244 GLW_LIB_DEPS="$GLW_LIB_DEPS"
1246 APP_LIB_DEPS="$APP_LIB_DEPS $GLW_LIB_DEPS"
1251 AC_SUBST([GLW_LIB_DEPS])
1252 AC_SUBST([GLW_MESA_DEPS])
1253 AC_SUBST([GLW_SOURCES])
1254 AC_SUBST([MOTIF_CFLAGS])
1255 AC_SUBST([GLW_PC_REQ_PRIV])
1256 AC_SUBST([GLW_PC_LIB_PRIV])
1257 AC_SUBST([GLW_PC_CFLAGS])
1260 dnl GLUT configuration
1262 if test -f "$srcdir/include/GL/glut.h"; then
1267 AC_ARG_ENABLE([glut],
1268 [AS_HELP_STRING([--disable-glut],
1269 [enable GLUT library @<:@default=enabled if source available@:>@])],
1270 [enable_glut="$enableval"],
1271 [enable_glut="$default_glut"])
1273 dnl Don't build glut on osmesa
1274 if test "x$enable_glut" = xyes; then
1275 case "$mesa_driver" in
1277 AC_MSG_NOTICE([Disabling glut since there is no OpenGL driver])
1282 dnl Can't build glut if GLU not available
1283 if test "x$enable_glu$enable_glut" = xnoyes; then
1284 AC_MSG_WARN([Disabling glut since GLU is disabled])
1288 if test "x$enable_glut" = xyes; then
1289 SRC_DIRS="$SRC_DIRS glut/glx"
1290 if test "$x11_pkgconfig" = yes; then
1291 PKG_CHECK_MODULES([GLUT],[x11 xmu xi])
1292 GLUT_PC_REQ_PRIV="x11 xmu xi"
1293 GLUT_LIB_DEPS="$GLUT_LIBS"
1295 # should check these...
1296 GLUT_LIB_DEPS="$X_LIBS -lX11 -lXmu -lXi"
1297 GLUT_PC_LIB_PRIV="$GLUT_LIB_DEPS"
1298 GLUT_PC_CFLAGS="$X11_INCLUDES"
1300 if test "x$GCC" = xyes; then
1301 GLUT_CFLAGS="$GLUT_CFLAGS -fexceptions"
1303 GLUT_LIB_DEPS="$GLUT_LIB_DEPS -lm"
1304 GLUT_PC_LIB_PRIV="$GLUT_PC_LIB_PRIV -lm"
1306 # If static, empty GLUT_LIB_DEPS and add libs for programs to link
1307 if test "$enable_static" = no; then
1308 GLUT_MESA_DEPS='-l$(GLU_LIB) -l$(GL_LIB)'
1310 APP_LIB_DEPS="$APP_LIB_DEPS $GLUT_LIB_DEPS"
1315 AC_SUBST([GLUT_LIB_DEPS])
1316 AC_SUBST([GLUT_MESA_DEPS])
1317 AC_SUBST([GLUT_CFLAGS])
1318 AC_SUBST([GLUT_PC_REQ_PRIV])
1319 AC_SUBST([GLUT_PC_LIB_PRIV])
1320 AC_SUBST([GLUT_PC_CFLAGS])
1323 dnl Program library dependencies
1324 dnl Only libm is added here if necessary as the libraries should
1325 dnl be pulled in by the linker
1327 if test "x$APP_LIB_DEPS" = x; then
1330 APP_LIB_DEPS="-lX11 -lsocket -lnsl -lm"
1333 APP_LIB_DEPS="-lX11"
1340 AC_SUBST([APP_LIB_DEPS])
1341 AC_SUBST([PROGRAM_DIRS])
1344 dnl Gallium configuration
1346 AC_ARG_ENABLE([gallium],
1347 [AS_HELP_STRING([--disable-gallium],
1348 [build gallium @<:@default=enabled@:>@])],
1349 [enable_gallium="$enableval"],
1350 [enable_gallium=yes])
1351 if test "x$enable_gallium" = xno -a "x$enable_openvg" = xyes; then
1352 AC_MSG_ERROR([cannot enable OpenVG without Gallium])
1354 if test "x$enable_gallium" = xyes; then
1355 SRC_DIRS="$SRC_DIRS gallium gallium/winsys gallium/targets"
1356 AC_CHECK_HEADER([udis86.h], [HAS_UDIS86="yes"],
1358 AC_PATH_PROG([LLVM_CONFIG], [llvm-config], [no])
1361 AC_SUBST([LLVM_CFLAGS])
1362 AC_SUBST([LLVM_LIBS])
1363 AC_SUBST([LLVM_LDFLAGS])
1364 AC_SUBST([LLVM_VERSION])
1367 dnl Gallium state trackers configuration
1370 AC_ARG_ENABLE([gallium-egl],
1371 [AS_HELP_STRING([--enable-gallium-egl],
1372 [enable gallium EGL state tracker @<:@default=auto@:>@])],
1373 [enable_gallium_egl="$enableval"],
1374 [enable_gallium_egl=auto])
1375 if test "x$enable_gallium_egl" = xauto; then
1376 case "$mesa_driver" in
1378 enable_gallium_egl=$enable_egl
1381 enable_gallium_egl=$enable_openvg
1385 case "x$enable_egl$enable_gallium_egl" in
1387 AC_MSG_ERROR([cannot build Gallium EGL state tracker without EGL])
1390 AC_ARG_WITH([state-trackers],
1391 [AS_HELP_STRING([--with-state-trackers@<:@=DIRS...@:>@],
1392 [comma delimited state_trackers list, e.g.
1393 "egl,glx" @<:@default=auto@:>@])],
1394 [with_state_trackers="$withval"],
1395 [with_state_trackers=yes])
1397 case "$with_state_trackers" in
1399 GALLIUM_STATE_TRACKERS_DIRS=""
1402 # look at what else is built
1403 case "$mesa_driver" in
1405 GALLIUM_STATE_TRACKERS_DIRS=glx
1408 GALLIUM_STATE_TRACKERS_DIRS="dri"
1410 # Have only tested st/xorg on 1.6.0 servers
1411 PKG_CHECK_MODULES(XORG, [xorg-server >= 1.6.0 libdrm >= $LIBDRM_XORG_REQUIRED libkms >= $LIBKMS_XORG_REQUIRED],
1412 HAVE_ST_XORG="yes"; GALLIUM_STATE_TRACKERS_DIRS="$GALLIUM_STATE_TRACKERS_DIRS xorg",
1417 if test "x$enable_egl" = xyes; then
1418 if test "$enable_openvg" = yes; then
1419 GALLIUM_STATE_TRACKERS_DIRS="$GALLIUM_STATE_TRACKERS_DIRS vega"
1423 if test "$enable_gallium_egl" = yes; then
1424 GALLIUM_STATE_TRACKERS_DIRS="$GALLIUM_STATE_TRACKERS_DIRS egl"
1430 # verify the requested state tracker exist
1432 _state_trackers=`IFS=', '; echo $with_state_trackers`
1433 for tracker in $_state_trackers; do
1436 if test "x$mesa_driver" != xdri; then
1437 AC_MSG_ERROR([cannot build dri state tracker without mesa driver set to dri])
1442 if test "x$enable_egl" != xyes; then
1443 AC_MSG_ERROR([cannot build egl state tracker without EGL library])
1448 PKG_CHECK_MODULES([XORG], [xorg-server >= 1.6.0])
1449 PKG_CHECK_MODULES([LIBDRM_XORG], [libdrm >= $LIBDRM_XORG_REQUIRED])
1450 PKG_CHECK_MODULES([LIBKMS_XORG], [libkms >= $LIBKMS_XORG_REQUIRED])
1454 if test "x$enable_openvg" != xyes; then
1455 AC_MSG_ERROR([cannot build vega state tracker without --enable-openvg])
1461 if test -n "$tracker"; then
1462 test -d "$srcdir/src/gallium/state_trackers/$tracker" || \
1463 AC_MSG_ERROR([state tracker '$tracker' doesn't exist])
1464 if test -n "$state_trackers"; then
1465 state_trackers="$state_trackers $tracker"
1467 state_trackers="$tracker"
1471 GALLIUM_STATE_TRACKERS_DIRS="$state_trackers"
1473 # append --enable-openvg/--enable-gallium-egl to --with-state-trackers
1474 if test "x$have_st_vega" != xyes -a "x$enable_openvg" = xyes; then
1475 AC_MSG_ERROR([--with-state-trackers specified but vega is missing])
1477 if test "x$HAVE_ST_EGL" != xyes -a "x$enable_gallium_egl" = xyes; then
1478 AC_MSG_ERROR([--with-state-trackers specified but egl is missing])
1487 case "x$enable_opengl$enable_gles1$enable_gles2" in
1489 EGL_CLIENT_APIS="$EGL_CLIENT_APIS "'$(GL_LIB)'
1492 if test "x$enable_openvg" = xyes; then
1493 EGL_CLIENT_APIS="$EGL_CLIENT_APIS "'$(VG_LIB)'
1494 VG_LIB_DEPS="$VG_LIB_DEPS -lpthread"
1497 AC_SUBST([VG_LIB_DEPS])
1498 AC_SUBST([EGL_CLIENT_APIS])
1500 if test "x$HAVE_ST_EGL" = xyes; then
1501 GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS egl"
1504 if test "x$HAVE_ST_XORG" = xyes; then
1505 PKG_CHECK_MODULES(XEXT, [xextproto >= 7.0.99.1],
1506 HAVE_XEXTPROTO_71="yes"; DEFINES="$DEFINES -DHAVE_XEXTPROTO_71",
1507 HAVE_XEXTPROTO_71="no")
1510 AC_ARG_WITH([egl-platforms],
1511 [AS_HELP_STRING([--with-egl-platforms@<:@=DIRS...@:>@],
1512 [comma delimited native platforms libEGL supports, e.g.
1513 "x11,drm" @<:@default=auto@:>@])],
1514 [with_egl_platforms="$withval"],
1515 [with_egl_platforms=yes])
1516 AC_ARG_WITH([egl-displays],
1517 [AS_HELP_STRING([--with-egl-displays@<:@=DIRS...@:>@],
1518 [DEPRECATED. Use --with-egl-platforms instead])],
1519 [with_egl_platforms="$withval"])
1522 case "$with_egl_platforms" in
1524 if test "x$enable_egl" = xyes && test "x$mesa_driver" != xosmesa; then
1526 if test "$mesa_driver" = dri; then
1527 EGL_PLATFORMS="$EGL_PLATFORMS drm"
1532 if test "x$enable_egl" != xyes; then
1533 AC_MSG_ERROR([cannot build egl state tracker without EGL library])
1535 # verify the requested driver directories exist
1536 egl_platforms=`IFS=', '; echo $with_egl_platforms`
1537 for plat in $egl_platforms; do
1538 test -d "$srcdir/src/gallium/state_trackers/egl/$plat" || \
1539 AC_MSG_ERROR([EGL platform '$plat' does't exist])
1540 if test "$plat" = "fbdev"; then
1541 GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS sw/fbdev"
1544 EGL_PLATFORMS="$egl_platforms"
1547 AC_SUBST([EGL_PLATFORMS])
1549 AC_ARG_WITH([egl-driver-dir],
1550 [AS_HELP_STRING([--with-egl-driver-dir=DIR],
1551 [directory for EGL drivers [[default=${libdir}/egl]]])],
1552 [EGL_DRIVER_INSTALL_DIR="$withval"],
1553 [EGL_DRIVER_INSTALL_DIR='${libdir}/egl'])
1554 AC_SUBST([EGL_DRIVER_INSTALL_DIR])
1556 AC_ARG_WITH([xorg-driver-dir],
1557 [AS_HELP_STRING([--with-xorg-driver-dir=DIR],
1558 [Default xorg driver directory[[default=${libdir}/xorg/modules/drivers]]])],
1559 [XORG_DRIVER_INSTALL_DIR="$withval"],
1560 [XORG_DRIVER_INSTALL_DIR="${libdir}/xorg/modules/drivers"])
1561 AC_SUBST([XORG_DRIVER_INSTALL_DIR])
1563 AC_ARG_WITH([max-width],
1564 [AS_HELP_STRING([--with-max-width=N],
1565 [Maximum framebuffer width (4096)])],
1566 [DEFINES="${DEFINES} -DMAX_WIDTH=${withval}";
1567 AS_IF([test "${withval}" -gt "4096"],
1568 [AC_MSG_WARN([Large framebuffer: see s_tritemp.h comments.])])]
1570 AC_ARG_WITH([max-height],
1571 [AS_HELP_STRING([--with-max-height=N],
1572 [Maximum framebuffer height (4096)])],
1573 [DEFINES="${DEFINES} -DMAX_HEIGHT=${withval}";
1574 AS_IF([test "${withval}" -gt "4096"],
1575 [AC_MSG_WARN([Large framebuffer: see s_tritemp.h comments.])])]
1581 AC_ARG_ENABLE([gallium-llvm],
1582 [AS_HELP_STRING([--enable-gallium-llvm],
1583 [build gallium LLVM support @<:@default=disabled@:>@])],
1584 [enable_gallium_llvm="$enableval"],
1585 [enable_gallium_llvm=auto])
1586 if test "x$enable_gallium_llvm" = xyes; then
1587 if test "x$LLVM_CONFIG" != xno; then
1588 LLVM_VERSION=`$LLVM_CONFIG --version`
1589 LLVM_CFLAGS=`$LLVM_CONFIG --cppflags`
1590 LLVM_LIBS="`$LLVM_CONFIG --libs jit interpreter nativecodegen bitwriter` -lstdc++"
1592 if test "x$HAS_UDIS86" != xno; then
1593 LLVM_LIBS="$LLVM_LIBS -ludis86"
1594 DEFINES="$DEFINES -DHAVE_UDIS86"
1596 LLVM_LDFLAGS=`$LLVM_CONFIG --ldflags`
1597 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS llvmpipe"
1598 DEFINES="$DEFINES -DGALLIUM_LLVMPIPE -D__STDC_CONSTANT_MACROS"
1608 dnl Gallium helper functions
1610 gallium_check_st() {
1611 if test "x$HAVE_ST_DRI" = xyes || test "x$HAVE_ST_XORG" = xyes; then
1612 GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS $1"
1614 if test "x$HAVE_ST_DRI" = xyes && test "x$2" != x; then
1615 GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS $2"
1617 if test "x$HAVE_ST_XORG" = xyes && test "x$3" != x; then
1618 GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS $3"
1624 dnl Gallium SVGA configuration
1626 AC_ARG_ENABLE([gallium-svga],
1627 [AS_HELP_STRING([--enable-gallium-svga],
1628 [build gallium SVGA @<:@default=disabled@:>@])],
1629 [enable_gallium_svga="$enableval"],
1630 [enable_gallium_svga=auto])
1631 if test "x$enable_gallium_svga" = xyes; then
1632 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS svga"
1633 gallium_check_st "svga/drm" "dri-vmwgfx" "xorg-vmwgfx"
1634 elif test "x$enable_gallium_svga" = xauto; then
1635 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS svga"
1639 dnl Gallium i915 configuration
1641 AC_ARG_ENABLE([gallium-i915],
1642 [AS_HELP_STRING([--enable-gallium-i915],
1643 [build gallium i915 @<:@default=disabled@:>@])],
1644 [enable_gallium_i915="$enableval"],
1645 [enable_gallium_i915=auto])
1646 if test "x$enable_gallium_i915" = xyes; then
1647 GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS i915/sw"
1648 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS i915"
1649 gallium_check_st "i915/drm" "dri-i915" "xorg-i915"
1650 elif test "x$enable_gallium_i915" = xauto; then
1651 GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS i915/sw"
1652 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS i915"
1656 dnl Gallium i965 configuration
1658 AC_ARG_ENABLE([gallium-i965],
1659 [AS_HELP_STRING([--enable-gallium-i965],
1660 [build gallium i965 @<:@default=disabled@:>@])],
1661 [enable_gallium_i965="$enableval"],
1662 [enable_gallium_i965=auto])
1663 if test "x$enable_gallium_i965" = xyes; then
1664 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS i965"
1665 gallium_check_st "i965/drm" "dri-i965" "xorg-i965"
1666 elif test "x$enable_gallium_i965" = xauto; then
1667 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS i965"
1671 dnl Gallium Radeon r300g configuration
1673 AC_ARG_ENABLE([gallium-radeon],
1674 [AS_HELP_STRING([--enable-gallium-radeon],
1675 [build gallium radeon @<:@default=disabled@:>@])],
1676 [enable_gallium_radeon="$enableval"],
1677 [enable_gallium_radeon=auto])
1678 if test "x$enable_gallium_radeon" = xauto; then
1679 if test "x$HAVE_LIBDRM_RADEON" = xyes; then
1680 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r300"
1681 gallium_check_st "radeon/drm" "dri-r300"
1683 AC_MSG_WARN([libdrm_radeon is missing, not building gallium-radeon (r300)])
1686 if test "x$enable_gallium_radeon" = xyes; then
1687 if test "x$HAVE_LIBDRM_RADEON" = xyes; then
1688 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r300"
1689 gallium_check_st "radeon/drm" "dri-r300" "xorg-radeon"
1691 AC_MSG_ERROR([libdrm_radeon is missing, cannot build gallium-radeon (r300)])
1696 dnl Gallium Radeon r600g configuration
1698 AC_ARG_ENABLE([gallium-r600],
1699 [AS_HELP_STRING([--enable-gallium-r600],
1700 [build gallium radeon @<:@default=disabled@:>@])],
1701 [enable_gallium_r600="$enableval"],
1702 [enable_gallium_r600=auto])
1703 if test "x$enable_gallium_r600" = xyes; then
1704 if test "x$HAVE_LIBDRM_RADEON" = xyes; then
1705 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r600"
1706 gallium_check_st "r600/drm" "dri-r600"
1708 AC_MSG_ERROR([libdrm_radeon is missing, cannot build gallium-r600])
1713 dnl Gallium Nouveau configuration
1715 AC_ARG_ENABLE([gallium-nouveau],
1716 [AS_HELP_STRING([--enable-gallium-nouveau],
1717 [build gallium nouveau @<:@default=disabled@:>@])],
1718 [enable_gallium_nouveau="$enableval"],
1719 [enable_gallium_nouveau=no])
1720 if test "x$enable_gallium_nouveau" = xyes; then
1721 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS nouveau nvfx nv50 nvc0"
1722 gallium_check_st "nouveau/drm" "dri-nouveau" "xorg-nouveau"
1726 dnl Gallium swrast configuration
1728 AC_ARG_ENABLE([gallium-swrast],
1729 [AS_HELP_STRING([--enable-gallium-swrast],
1730 [build gallium swrast @<:@default=auto@:>@])],
1731 [enable_gallium_swrast="$enableval"],
1732 [enable_gallium_swrast=auto])
1733 if test "x$enable_gallium_swrast" = xyes || test "x$enable_gallium_swrast" = xauto; then
1734 if test "x$HAVE_ST_DRI" = xyes; then
1735 GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS dri-swrast"
1739 dnl prepend CORE_DIRS to SRC_DIRS
1740 SRC_DIRS="$CORE_DIRS $SRC_DIRS"
1742 dnl Restore LDFLAGS and CPPFLAGS
1743 LDFLAGS="$_SAVE_LDFLAGS"
1744 CPPFLAGS="$_SAVE_CPPFLAGS"
1746 dnl Substitute the config
1747 AC_CONFIG_FILES([configs/autoconf])
1749 dnl Replace the configs/current symlink
1750 AC_CONFIG_COMMANDS([configs],[
1751 if test -f configs/current || test -L configs/current; then
1752 rm -f configs/current
1754 ln -s autoconf configs/current
1760 dnl Output some configuration info for the user
1763 echo " prefix: $prefix"
1764 echo " exec_prefix: $exec_prefix"
1765 echo " libdir: $libdir"
1766 echo " includedir: $includedir"
1770 echo " OpenGL: $enable_opengl (ES1: $enable_gles1 ES2: $enable_gles2)"
1771 echo " OpenVG: $enable_openvg"
1775 echo " Driver: $mesa_driver"
1776 if test "$mesa_driver" != no; then
1777 if echo "$DRIVER_DIRS" | grep 'osmesa' >/dev/null 2>&1; then
1778 echo " OSMesa: lib$OSMESA_LIB"
1782 if test "$mesa_driver" = dri; then
1783 # cleanup the drivers var
1784 dri_dirs=`echo $DRI_DIRS | $SED 's/^ *//;s/ */ /;s/ *$//'`
1785 if test "x$DRI_DIRS" = x; then
1786 echo " DRI drivers: no"
1788 echo " DRI drivers: $dri_dirs"
1790 echo " DRI driver dir: $DRI_DRIVER_INSTALL_DIR"
1791 echo " Use XCB: $enable_xcb"
1795 echo " GLU: $enable_glu"
1796 echo " GLw: $enable_glw (Motif: $enable_motif)"
1797 echo " glut: $enable_glut"
1801 echo " EGL: $enable_egl"
1802 if test "$enable_egl" = yes; then
1803 echo " EGL platforms: $EGL_PLATFORMS"
1806 for d in $EGL_DRIVERS_DIRS; do
1807 egl_drivers="$egl_drivers builtin:egl_$d"
1810 if test "$enable_gallium" = yes -a "$HAVE_ST_EGL" = yes; then
1811 echo " EGL drivers: ${egl_drivers} egl_gallium"
1812 echo " EGL Gallium STs:$EGL_CLIENT_APIS"
1814 echo " EGL drivers: $egl_drivers"
1819 if test "x$MESA_LLVM" = x1; then
1821 echo " llvm-config: $LLVM_CONFIG"
1822 echo " llvm-version: $LLVM_VERSION"
1828 if echo "$SRC_DIRS" | grep 'gallium' >/dev/null 2>&1; then
1829 echo " Gallium: yes"
1830 echo " Gallium dirs: $GALLIUM_DIRS"
1831 echo " Target dirs: $GALLIUM_TARGET_DIRS"
1832 echo " Winsys dirs: $GALLIUM_WINSYS_DIRS"
1833 echo " Driver dirs: $GALLIUM_DRIVERS_DIRS"
1834 echo " Trackers dirs: $GALLIUM_STATE_TRACKERS_DIRS"
1841 echo " Shared libs: $enable_shared"
1842 echo " Static libs: $enable_static"
1844 dnl Compiler options
1845 # cleanup the CFLAGS/CXXFLAGS/DEFINES vars
1846 cflags=`echo $CFLAGS $OPT_FLAGS $PIC_FLAGS $ARCH_FLAGS | \
1847 $SED 's/^ *//;s/ */ /;s/ *$//'`
1848 cxxflags=`echo $CXXFLAGS $OPT_FLAGS $PIC_FLAGS $ARCH_FLAGS | \
1849 $SED 's/^ *//;s/ */ /;s/ *$//'`
1850 defines=`echo $DEFINES $ASM_FLAGS | $SED 's/^ *//;s/ */ /;s/ *$//'`
1852 echo " CFLAGS: $cflags"
1853 echo " CXXFLAGS: $cxxflags"
1854 echo " Macros: $defines"
1856 echo " PYTHON2: $PYTHON2"
1859 echo " Run '${MAKE-make}' to build Mesa"