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])
587 dnl Driver specific build directories
590 dnl this variable will be prepended to SRC_DIRS and is not exported
595 GALLIUM_DIRS="auxiliary drivers state_trackers"
596 GALLIUM_TARGET_DIRS=""
597 GALLIUM_WINSYS_DIRS="sw"
598 GALLIUM_DRIVERS_DIRS="softpipe failover galahad trace rbug noop identity"
599 GALLIUM_STATE_TRACKERS_DIRS=""
601 # build shared-glapi if enabled for OpenGL or if OpenGL ES is enabled
602 case "x$enabled_shared_glapi$enable_gles1$enable_gles2" in
604 CORE_DIRS="$CORE_DIRS mapi/shared-glapi"
608 # build glapi if OpenGL is enabled
609 if test "x$enable_opengl" = xyes; then
610 CORE_DIRS="$CORE_DIRS mapi/glapi"
613 # build es1api if OpenGL ES 1.x is enabled
614 if test "x$enable_gles1" = xyes; then
615 CORE_DIRS="$CORE_DIRS mapi/es1api"
618 # build es2api if OpenGL ES 2.x is enabled
619 if test "x$enable_gles2" = xyes; then
620 CORE_DIRS="$CORE_DIRS mapi/es2api"
623 # build vgapi if OpenVG is enabled
624 if test "x$enable_openvg" = xyes; then
625 CORE_DIRS="$CORE_DIRS mapi/vgapi"
628 # build glsl and mesa if OpenGL or OpenGL ES is enabled
629 case "x$enable_opengl$enable_gles1$enable_gles2" in
631 CORE_DIRS="$CORE_DIRS glsl mesa"
635 case "$mesa_driver" in
638 GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS sw/xlib"
639 GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS libgl-xlib"
642 SRC_DIRS="$SRC_DIRS glx"
644 GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS sw/xlib sw/dri"
655 AC_SUBST([DRIVER_DIRS])
656 AC_SUBST([GALLIUM_DIRS])
657 AC_SUBST([GALLIUM_TARGET_DIRS])
658 AC_SUBST([GALLIUM_WINSYS_DIRS])
659 AC_SUBST([GALLIUM_DRIVERS_DIRS])
660 AC_SUBST([GALLIUM_STATE_TRACKERS_DIRS])
661 AC_SUBST([MESA_LLVM])
664 dnl Find out if X is available. The variable have_x is set if libX11 is
665 dnl found to mimic AC_PATH_XTRA.
667 if test -n "$PKG_CONFIG"; then
668 AC_MSG_CHECKING([pkg-config files for X11 are available])
669 PKG_CHECK_EXISTS([x11],[
675 AC_MSG_RESULT([$x11_pkgconfig])
679 dnl Use the autoconf macro if no pkg-config files
680 if test "$x11_pkgconfig" = yes; then
681 PKG_CHECK_MODULES([X11], [x11])
684 test -z "$X11_CFLAGS" && X11_CFLAGS="$X_CFLAGS"
685 test -z "$X11_LIBS" && X11_LIBS="$X_LIBS -lX11"
686 AC_SUBST([X11_CFLAGS])
690 dnl Try to tell the user that the --x-* options are only used when
691 dnl pkg-config is not available. This must be right after AC_PATH_XTRA.
692 m4_divert_once([HELP_BEGIN],
693 [These options are only used when the X libraries cannot be found by the
694 pkg-config utility.])
696 dnl We need X for xlib and dri, so bomb now if it's not found
697 case "$mesa_driver" in
699 if test "$no_x" = yes; then
700 AC_MSG_ERROR([X11 development libraries needed for $mesa_driver driver])
705 dnl XCB - this is only used for GLX right now
707 [AS_HELP_STRING([--enable-xcb],
708 [use XCB for GLX @<:@default=disabled@:>@])],
709 [enable_xcb="$enableval"],
711 if test "x$enable_xcb" = xyes; then
712 DEFINES="$DEFINES -DUSE_XCB"
718 dnl libGL configuration per driver
720 case "$mesa_driver" in
722 if test "$x11_pkgconfig" = yes; then
723 PKG_CHECK_MODULES([XLIBGL], [x11 xext])
724 GL_PC_REQ_PRIV="x11 xext"
725 X11_INCLUDES="$X11_INCLUDES $XLIBGL_CFLAGS"
726 GL_LIB_DEPS="$XLIBGL_LIBS"
728 # should check these...
729 X11_INCLUDES="$X11_INCLUDES $X_CFLAGS"
730 GL_LIB_DEPS="$X_LIBS -lX11 -lXext"
731 GL_PC_LIB_PRIV="$GL_LIB_DEPS"
732 GL_PC_CFLAGS="$X11_INCLUDES"
734 GL_LIB_DEPS="$GL_LIB_DEPS $SELINUX_LIBS -lm -lpthread"
735 GL_PC_LIB_PRIV="$GL_PC_LIB_PRIV $SELINUX_LIBS -lm -lpthread"
737 # if static, move the external libraries to the programs
738 # and empty the libraries for libGL
739 if test "$enable_static" = yes; then
740 APP_LIB_DEPS="$APP_LIB_DEPS $GL_LIB_DEPS"
744 dri|no) # these checks are still desired when there is no mesa_driver
745 # DRI must be shared, I think
746 if test "$enable_static" = yes; then
747 AC_MSG_ERROR([Can't use static libraries for DRI drivers])
751 PKG_CHECK_MODULES([LIBDRM], [libdrm >= $LIBDRM_REQUIRED])
752 PKG_CHECK_MODULES([DRI2PROTO], [dri2proto >= $DRI2PROTO_REQUIRED])
753 PKG_CHECK_MODULES([GLPROTO], [glproto >= $GLPROTO_REQUIRED])
754 GL_PC_REQ_PRIV="libdrm >= $LIBDRM_REQUIRED dri2proto >= $DRI2PROTO_REQUIRED glproto >= $GLPROTO_REQUIRED"
755 DRI_PC_REQ_PRIV="libdrm >= $LIBDRM_REQUIRED"
757 # find the DRI deps for libGL
758 if test "$x11_pkgconfig" = yes; then
759 dri_modules="x11 xext xdamage xfixes"
761 # add xf86vidmode if available
762 PKG_CHECK_MODULES([XF86VIDMODE], [xxf86vm], HAVE_XF86VIDMODE=yes, HAVE_XF86VIDMODE=no)
763 if test "$HAVE_XF86VIDMODE" = yes ; then
764 dri_modules="$dri_modules xxf86vm"
767 # add xcb modules if necessary
768 if test "$enable_xcb" = yes; then
769 dri_modules="$dri_modules x11-xcb xcb-glx"
772 PKG_CHECK_MODULES([DRIGL], [$dri_modules])
773 GL_PC_REQ_PRIV="$GL_PC_REQ_PRIV $dri_modules"
774 X11_INCLUDES="$X11_INCLUDES $DRIGL_CFLAGS"
775 GL_LIB_DEPS="$DRIGL_LIBS"
777 # should check these...
778 X11_INCLUDES="$X11_INCLUDES $X_CFLAGS"
779 GL_LIB_DEPS="$X_LIBS -lX11 -lXext -lXxf86vm -lXdamage -lXfixes"
780 GL_PC_LIB_PRIV="$GL_LIB_DEPS"
781 GL_PC_CFLAGS="$X11_INCLUDES"
783 # XCB can only be used from pkg-config
784 if test "$enable_xcb" = yes; then
785 PKG_CHECK_MODULES([XCB],[x11-xcb xcb-glx])
786 GL_PC_REQ_PRIV="$GL_PC_REQ_PRIV x11-xcb xcb-glx"
787 X11_INCLUDES="$X11_INCLUDES $XCB_CFLAGS"
788 GL_LIB_DEPS="$GL_LIB_DEPS $XCB_LIBS"
792 # need DRM libs, -lpthread, etc.
793 GL_LIB_DEPS="$GL_LIB_DEPS $LIBDRM_LIBS -lm -lpthread $DLOPEN_LIBS"
794 GL_PC_LIB_PRIV="-lm -lpthread $DLOPEN_LIBS"
795 GLESv1_CM_LIB_DEPS="$LIBDRM_LIBS -lm -lpthread $DLOPEN_LIBS"
796 GLESv1_CM_PC_LIB_PRIV="-lm -lpthread $DLOPEN_LIBS"
797 GLESv2_LIB_DEPS="$LIBDRM_LIBS -lm -lpthread $DLOPEN_LIBS"
798 GLESv2_PC_LIB_PRIV="-lm -lpthread $DLOPEN_LIBS"
801 # No libGL for osmesa
805 AC_SUBST([GL_LIB_DEPS])
806 AC_SUBST([GL_PC_REQ_PRIV])
807 AC_SUBST([GL_PC_LIB_PRIV])
808 AC_SUBST([GL_PC_CFLAGS])
809 AC_SUBST([DRI_PC_REQ_PRIV])
810 AC_SUBST([GLESv1_CM_LIB_DEPS])
811 AC_SUBST([GLESv1_CM_PC_LIB_PRIV])
812 AC_SUBST([GLESv2_LIB_DEPS])
813 AC_SUBST([GLESv2_PC_LIB_PRIV])
815 GLAPI_LIB_DEPS="-lpthread"
816 AC_SUBST([GLAPI_LIB_DEPS])
818 AC_SUBST([HAVE_XF86VIDMODE])
820 PKG_CHECK_MODULES([LIBDRM_RADEON],
821 [libdrm_radeon libdrm >= $LIBDRM_RADEON_REQUIRED],
822 HAVE_LIBDRM_RADEON=yes,
823 HAVE_LIBDRM_RADEON=no)
828 if test "$mesa_driver" = xlib; then
829 DEFINES="$DEFINES -DUSE_XSHM"
836 AC_ARG_ENABLE([glx-tls],
837 [AS_HELP_STRING([--enable-glx-tls],
838 [enable TLS support in GLX @<:@default=disabled@:>@])],
839 [GLX_USE_TLS="$enableval"],
841 AC_SUBST(GLX_TLS, ${GLX_USE_TLS})
846 dnl Directory for DRI drivers
847 AC_ARG_WITH([dri-driverdir],
848 [AS_HELP_STRING([--with-dri-driverdir=DIR],
849 [directory for the DRI drivers @<:@${libdir}/dri@:>@])],
850 [DRI_DRIVER_INSTALL_DIR="$withval"],
851 [DRI_DRIVER_INSTALL_DIR='${libdir}/dri'])
852 AC_SUBST([DRI_DRIVER_INSTALL_DIR])
853 dnl Extra search path for DRI drivers
854 AC_ARG_WITH([dri-searchpath],
855 [AS_HELP_STRING([--with-dri-searchpath=DIRS...],
856 [semicolon delimited DRI driver search directories @<:@${libdir}/dri@:>@])],
857 [DRI_DRIVER_SEARCH_DIR="$withval"],
858 [DRI_DRIVER_SEARCH_DIR='${DRI_DRIVER_INSTALL_DIR}'])
859 AC_SUBST([DRI_DRIVER_SEARCH_DIR])
860 dnl Direct rendering or just indirect rendering
861 AC_ARG_ENABLE([driglx-direct],
862 [AS_HELP_STRING([--disable-driglx-direct],
863 [enable direct rendering in GLX and EGL for DRI @<:@default=enabled@:>@])],
864 [driglx_direct="$enableval"],
865 [driglx_direct="yes"])
866 dnl Which drivers to build - default is chosen by platform
867 AC_ARG_WITH([dri-drivers],
868 [AS_HELP_STRING([--with-dri-drivers@<:@=DIRS...@:>@],
869 [comma delimited DRI drivers list, e.g.
870 "swrast,i965,radeon" @<:@default=auto@:>@])],
871 [with_dri_drivers="$withval"],
872 [with_dri_drivers=yes])
873 if test "x$with_dri_drivers" = x; then
877 dnl If $with_dri_drivers is yes, directories will be added through
880 case "$with_dri_drivers" in
886 # verify the requested driver directories exist
887 dri_drivers=`IFS=', '; echo $with_dri_drivers`
888 for driver in $dri_drivers; do
889 test -d "$srcdir/src/mesa/drivers/dri/$driver" || \
890 AC_MSG_ERROR([DRI driver directory '$driver' doesn't exist])
892 DRI_DIRS="$dri_drivers"
896 dnl Set DRI_DIRS, DEFINES and LIB_DEPS
897 if test "$mesa_driver" = dri -o "$mesa_driver" = no; then
899 if test "x$GLX_USE_TLS" = xyes; then
900 DEFINES="$DEFINES -DGLX_USE_TLS -DPTHREADS"
903 # Platform specific settings and drivers to build
906 DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
907 if test "x$driglx_direct" = xyes; then
908 DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
910 DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING -DHAVE_ALIAS"
914 # sis is missing because they have not be converted to use
915 # the new interface. i810 are missing because there is no
916 # x86-64 system where they could *ever* be used.
917 if test "x$DRI_DIRS" = "xyes"; then
918 DRI_DIRS="i915 i965 mach64 mga r128 r200 r300 r600 radeon \
919 savage tdfx unichrome swrast"
923 # Build only the drivers for cards that exist on PowerPC.
924 # At some point MGA will be added, but not yet.
925 if test "x$DRI_DIRS" = "xyes"; then
926 DRI_DIRS="mach64 r128 r200 r300 r600 radeon tdfx swrast"
930 # Build only the drivers for cards that exist on sparc`
931 if test "x$DRI_DIRS" = "xyes"; then
932 DRI_DIRS="mach64 r128 r200 r300 r600 radeon swrast"
937 freebsd* | dragonfly* | *netbsd*)
938 DEFINES="$DEFINES -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1"
939 DEFINES="$DEFINES -DIN_DRI_DRIVER -DHAVE_ALIAS"
940 DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING"
941 if test "x$driglx_direct" = xyes; then
942 DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
945 if test "x$DRI_DIRS" = "xyes"; then
946 DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 r600 radeon tdfx \
947 unichrome savage sis swrast"
951 DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
952 DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING -DHAVE_ALIAS"
955 DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
956 DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING"
957 if test "x$driglx_direct" = xyes; then
958 DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
964 if test "x$DRI_DIRS" = "xyes"; then
965 DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 r600 radeon \
966 savage sis tdfx unichrome swrast"
969 DRI_DIRS=`echo "$DRI_DIRS" | $SED 's/ */ /g'`
972 if test "$mesa_driver" = dri; then
976 [AS_HELP_STRING([--with-expat=DIR],
977 [expat install directory])],[
978 EXPAT_INCLUDES="-I$withval/include"
979 CPPFLAGS="$CPPFLAGS $EXPAT_INCLUDES"
980 LDFLAGS="$LDFLAGS -L$withval/$LIB_DIR"
981 EXPAT_LIB="-L$withval/$LIB_DIR -lexpat"
983 AC_CHECK_HEADER([expat.h],[],[AC_MSG_ERROR([Expat required for DRI.])])
984 AC_CHECK_LIB([expat],[XML_ParserCreate],[],
985 [AC_MSG_ERROR([Expat required for DRI.])])
988 # put all the necessary libs together
989 DRI_LIB_DEPS="$SELINUX_LIBS $LIBDRM_LIBS $EXPAT_LIB -lm -lpthread $DLOPEN_LIBS"
992 AC_SUBST([EXPAT_INCLUDES])
993 AC_SUBST([DRI_LIB_DEPS])
997 PKG_CHECK_MODULES([INTEL], [libdrm_intel >= $LIBDRM_INTEL_REQUIRED])
1002 *radeon*|*r200*|*r300*|*r600*)
1003 if test "x$HAVE_LIBDRM_RADEON" = xyes; then
1004 RADEON_CFLAGS="-DHAVE_LIBDRM_RADEON=1 $LIBDRM_RADEON_CFLAGS"
1005 RADEON_LDFLAGS=$LIBDRM_RADEON_LIBS
1009 AC_SUBST([RADEON_CFLAGS])
1010 AC_SUBST([RADEON_LDFLAGS])
1014 dnl OSMesa configuration
1016 if test "$mesa_driver" = xlib; then
1017 default_gl_osmesa=yes
1019 default_gl_osmesa=no
1021 AC_ARG_ENABLE([gl-osmesa],
1022 [AS_HELP_STRING([--enable-gl-osmesa],
1023 [enable OSMesa with libGL @<:@default=enabled for xlib driver@:>@])],
1024 [gl_osmesa="$enableval"],
1025 [gl_osmesa="$default_gl_osmesa"])
1026 if test "x$gl_osmesa" = xyes; then
1027 if test "x$enable_opengl" = xno; then
1028 AC_MSG_ERROR([OpenGL is not available for OSMesa driver])
1030 if test "$mesa_driver" = osmesa; then
1031 AC_MSG_ERROR([libGL is not available for OSMesa driver])
1033 DRIVER_DIRS="$DRIVER_DIRS osmesa"
1037 dnl Configure the channel bits for OSMesa (libOSMesa, libOSMesa16, ...)
1038 AC_ARG_WITH([osmesa-bits],
1039 [AS_HELP_STRING([--with-osmesa-bits=BITS],
1040 [OSMesa channel bits and library name: 8, 16, 32 @<:@default=8@:>@])],
1041 [osmesa_bits="$withval"],
1043 if test "$mesa_driver" != osmesa && test "x$osmesa_bits" != x8; then
1044 AC_MSG_WARN([Ignoring OSMesa channel bits for non-OSMesa driver])
1047 case "x$osmesa_bits" in
1052 OSMESA_LIB="OSMesa$osmesa_bits"
1053 DEFINES="$DEFINES -DCHAN_BITS=$osmesa_bits -DDEFAULT_SOFTWARE_DEPTH_BITS=31"
1056 AC_MSG_ERROR([OSMesa bits '$osmesa_bits' is not a valid option])
1059 AC_SUBST([OSMESA_LIB])
1061 case "$DRIVER_DIRS" in
1063 # only link libraries with osmesa if shared
1064 if test "$enable_static" = no; then
1065 OSMESA_LIB_DEPS="-lm -lpthread $SELINUX_LIBS $DLOPEN_LIBS"
1070 OSMESA_PC_LIB_PRIV="-lm -lpthread $SELINUX_LIBS $DLOPEN_LIBS"
1073 AC_SUBST([OSMESA_LIB_DEPS])
1074 AC_SUBST([OSMESA_MESA_DEPS])
1075 AC_SUBST([OSMESA_PC_REQ])
1076 AC_SUBST([OSMESA_PC_LIB_PRIV])
1079 dnl EGL configuration
1081 AC_ARG_ENABLE([egl],
1082 [AS_HELP_STRING([--disable-egl],
1083 [disable EGL library @<:@default=enabled@:>@])],
1084 [enable_egl="$enableval"],
1086 if test "x$enable_egl" = xno; then
1087 if test "x$mesa_driver" = xno; then
1088 AC_MSG_ERROR([cannot disable EGL when there is no mesa driver])
1090 if test "x$enable_openvg" = xyes; then
1091 AC_MSG_ERROR([cannot enable OpenVG without EGL])
1094 if test "x$enable_egl" = xyes; then
1095 SRC_DIRS="$SRC_DIRS egl"
1096 EGL_LIB_DEPS="$DLOPEN_LIBS -lpthread"
1098 if test "$enable_static" != yes; then
1099 # build egl_glx when libGL is built
1100 if test "$mesa_driver" = xlib -o "$mesa_driver" = dri; then
1101 EGL_DRIVERS_DIRS="glx"
1104 if test "$mesa_driver" = dri; then
1105 # build egl_dri2 when xcb-dri2 is available
1106 PKG_CHECK_MODULES([XCB_DRI2], [x11-xcb xcb-dri2 xcb-xfixes],
1107 [have_xcb_dri2=yes],[have_xcb_dri2=no])
1108 PKG_CHECK_MODULES([LIBUDEV], [libudev > 150],
1109 [have_libudev=yes],[have_libudev=no])
1111 if test "$have_xcb_dri2" = yes; then
1112 EGL_DRIVER_DRI2=dri2
1113 DEFINES="$DEFINES -DHAVE_XCB_DRI2"
1114 if test "$have_libudev" = yes; then
1115 DEFINES="$DEFINES -DHAVE_LIBUDEV"
1120 EGL_DRIVERS_DIRS="$EGL_DRIVERS_DIRS $EGL_DRIVER_DRI2"
1123 AC_SUBST([EGL_LIB_DEPS])
1124 AC_SUBST([EGL_DRIVERS_DIRS])
1127 dnl GLU configuration
1129 AC_ARG_ENABLE([glu],
1130 [AS_HELP_STRING([--disable-glu],
1131 [enable OpenGL Utility library @<:@default=enabled@:>@])],
1132 [enable_glu="$enableval"],
1135 if test "x$enable_glu" = xyes -a "x$mesa_driver" = xno; then
1136 AC_MSG_NOTICE([Disabling GLU since there is no OpenGL driver])
1140 if test "x$enable_glu" = xyes; then
1141 SRC_DIRS="$SRC_DIRS glu"
1143 case "$mesa_driver" in
1145 # Link libGLU to libOSMesa instead of libGL
1148 if test "$enable_static" = no; then
1149 GLU_MESA_DEPS='-l$(OSMESA_LIB)'
1155 # If static, empty GLU_LIB_DEPS and add libs for programs to link
1157 GLU_PC_LIB_PRIV="-lm"
1158 if test "$enable_static" = no; then
1160 GLU_MESA_DEPS='-l$(GL_LIB)'
1164 APP_LIB_DEPS="$APP_LIB_DEPS -lstdc++"
1169 if test "$enable_static" = no; then
1170 GLU_LIB_DEPS="$GLU_LIB_DEPS $OS_CPLUSPLUS_LIBS"
1172 GLU_PC_LIB_PRIV="$GLU_PC_LIB_PRIV $OS_CPLUSPLUS_LIBS"
1173 AC_SUBST([GLU_LIB_DEPS])
1174 AC_SUBST([GLU_MESA_DEPS])
1175 AC_SUBST([GLU_PC_REQ])
1176 AC_SUBST([GLU_PC_REQ_PRIV])
1177 AC_SUBST([GLU_PC_LIB_PRIV])
1178 AC_SUBST([GLU_PC_CFLAGS])
1181 dnl GLw configuration
1183 AC_ARG_ENABLE([glw],
1184 [AS_HELP_STRING([--disable-glw],
1185 [enable Xt/Motif widget library @<:@default=enabled@:>@])],
1186 [enable_glw="$enableval"],
1188 dnl Don't build GLw on osmesa
1189 if test "x$enable_glw" = xyes; then
1190 case "$mesa_driver" in
1192 AC_MSG_NOTICE([Disabling GLw since there is no OpenGL driver])
1197 AC_ARG_ENABLE([motif],
1198 [AS_HELP_STRING([--enable-motif],
1199 [use Motif widgets in GLw @<:@default=disabled@:>@])],
1200 [enable_motif="$enableval"],
1203 if test "x$enable_glw" = xyes; then
1204 SRC_DIRS="$SRC_DIRS glw"
1205 if test "$x11_pkgconfig" = yes; then
1206 PKG_CHECK_MODULES([GLW],[x11 xt])
1207 GLW_PC_REQ_PRIV="x11 xt"
1208 GLW_LIB_DEPS="$GLW_LIBS"
1210 # should check these...
1211 GLW_LIB_DEPS="$X_LIBS -lXt -lX11"
1212 GLW_PC_LIB_PRIV="$GLW_LIB_DEPS"
1213 GLW_PC_CFLAGS="$X11_INCLUDES"
1216 GLW_SOURCES="GLwDrawA.c"
1218 if test "x$enable_motif" = xyes; then
1219 GLW_SOURCES="$GLW_SOURCES GLwMDrawA.c"
1220 AC_PATH_PROG([MOTIF_CONFIG], [motif-config], [no])
1221 if test "x$MOTIF_CONFIG" != xno; then
1222 MOTIF_CFLAGS=`$MOTIF_CONFIG --cflags`
1223 MOTIF_LIBS=`$MOTIF_CONFIG --libs`
1225 AC_CHECK_HEADER([Xm/PrimitiveP.h], [],
1226 [AC_MSG_ERROR([Can't locate Motif headers])])
1227 AC_CHECK_LIB([Xm], [XmGetPixmap], [MOTIF_LIBS="-lXm"],
1228 [AC_MSG_ERROR([Can't locate Motif Xm library])])
1230 # MOTIF_LIBS is prepended to GLW_LIB_DEPS since Xm needs Xt/X11
1231 GLW_LIB_DEPS="$MOTIF_LIBS $GLW_LIB_DEPS"
1232 GLW_PC_LIB_PRIV="$MOTIF_LIBS $GLW_PC_LIB_PRIV"
1233 GLW_PC_CFLAGS="$MOTIF_CFLAGS $GLW_PC_CFLAGS"
1236 # If static, empty GLW_LIB_DEPS and add libs for programs to link
1237 GLW_PC_LIB_PRIV="$GLW_PC_LIB_PRIV"
1238 if test "$enable_static" = no; then
1239 GLW_MESA_DEPS='-l$(GL_LIB)'
1240 GLW_LIB_DEPS="$GLW_LIB_DEPS"
1242 APP_LIB_DEPS="$APP_LIB_DEPS $GLW_LIB_DEPS"
1247 AC_SUBST([GLW_LIB_DEPS])
1248 AC_SUBST([GLW_MESA_DEPS])
1249 AC_SUBST([GLW_SOURCES])
1250 AC_SUBST([MOTIF_CFLAGS])
1251 AC_SUBST([GLW_PC_REQ_PRIV])
1252 AC_SUBST([GLW_PC_LIB_PRIV])
1253 AC_SUBST([GLW_PC_CFLAGS])
1256 dnl GLUT configuration
1258 if test -f "$srcdir/include/GL/glut.h"; then
1263 AC_ARG_ENABLE([glut],
1264 [AS_HELP_STRING([--disable-glut],
1265 [enable GLUT library @<:@default=enabled if source available@:>@])],
1266 [enable_glut="$enableval"],
1267 [enable_glut="$default_glut"])
1269 dnl Don't build glut on osmesa
1270 if test "x$enable_glut" = xyes; then
1271 case "$mesa_driver" in
1273 AC_MSG_NOTICE([Disabling glut since there is no OpenGL driver])
1278 dnl Can't build glut if GLU not available
1279 if test "x$enable_glu$enable_glut" = xnoyes; then
1280 AC_MSG_WARN([Disabling glut since GLU is disabled])
1284 if test "x$enable_glut" = xyes; then
1285 SRC_DIRS="$SRC_DIRS glut/glx"
1286 if test "$x11_pkgconfig" = yes; then
1287 PKG_CHECK_MODULES([GLUT],[x11 xmu xi])
1288 GLUT_PC_REQ_PRIV="x11 xmu xi"
1289 GLUT_LIB_DEPS="$GLUT_LIBS"
1291 # should check these...
1292 GLUT_LIB_DEPS="$X_LIBS -lX11 -lXmu -lXi"
1293 GLUT_PC_LIB_PRIV="$GLUT_LIB_DEPS"
1294 GLUT_PC_CFLAGS="$X11_INCLUDES"
1296 if test "x$GCC" = xyes; then
1297 GLUT_CFLAGS="$GLUT_CFLAGS -fexceptions"
1299 GLUT_LIB_DEPS="$GLUT_LIB_DEPS -lm"
1300 GLUT_PC_LIB_PRIV="$GLUT_PC_LIB_PRIV -lm"
1302 # If static, empty GLUT_LIB_DEPS and add libs for programs to link
1303 if test "$enable_static" = no; then
1304 GLUT_MESA_DEPS='-l$(GLU_LIB) -l$(GL_LIB)'
1306 APP_LIB_DEPS="$APP_LIB_DEPS $GLUT_LIB_DEPS"
1311 AC_SUBST([GLUT_LIB_DEPS])
1312 AC_SUBST([GLUT_MESA_DEPS])
1313 AC_SUBST([GLUT_CFLAGS])
1314 AC_SUBST([GLUT_PC_REQ_PRIV])
1315 AC_SUBST([GLUT_PC_LIB_PRIV])
1316 AC_SUBST([GLUT_PC_CFLAGS])
1319 dnl Program library dependencies
1320 dnl Only libm is added here if necessary as the libraries should
1321 dnl be pulled in by the linker
1323 if test "x$APP_LIB_DEPS" = x; then
1326 APP_LIB_DEPS="-lX11 -lsocket -lnsl -lm"
1329 APP_LIB_DEPS="-lX11"
1336 AC_SUBST([APP_LIB_DEPS])
1337 AC_SUBST([PROGRAM_DIRS])
1340 dnl Gallium configuration
1342 AC_ARG_ENABLE([gallium],
1343 [AS_HELP_STRING([--disable-gallium],
1344 [build gallium @<:@default=enabled@:>@])],
1345 [enable_gallium="$enableval"],
1346 [enable_gallium=yes])
1347 if test "x$enable_gallium" = xno -a "x$enable_openvg" = xyes; then
1348 AC_MSG_ERROR([cannot enable OpenVG without Gallium])
1350 if test "x$enable_gallium" = xyes; then
1351 SRC_DIRS="$SRC_DIRS gallium gallium/winsys gallium/targets"
1352 AC_CHECK_HEADER([udis86.h], [HAS_UDIS86="yes"],
1354 AC_PATH_PROG([LLVM_CONFIG], [llvm-config], [no])
1357 AC_SUBST([LLVM_CFLAGS])
1358 AC_SUBST([LLVM_LIBS])
1359 AC_SUBST([LLVM_LDFLAGS])
1360 AC_SUBST([LLVM_VERSION])
1363 dnl Gallium state trackers configuration
1366 AC_ARG_ENABLE([gallium-egl],
1367 [AS_HELP_STRING([--enable-gallium-egl],
1368 [enable gallium EGL state tracker @<:@default=auto@:>@])],
1369 [enable_gallium_egl="$enableval"],
1370 [enable_gallium_egl=auto])
1371 if test "x$enable_gallium_egl" = xauto; then
1372 case "$mesa_driver" in
1374 enable_gallium_egl=$enable_egl
1377 enable_gallium_egl=$enable_openvg
1381 case "x$enable_egl$enable_gallium_egl" in
1383 AC_MSG_ERROR([cannot build Gallium EGL state tracker without EGL])
1386 AC_ARG_WITH([state-trackers],
1387 [AS_HELP_STRING([--with-state-trackers@<:@=DIRS...@:>@],
1388 [comma delimited state_trackers list, e.g.
1389 "egl,glx" @<:@default=auto@:>@])],
1390 [with_state_trackers="$withval"],
1391 [with_state_trackers=yes])
1393 case "$with_state_trackers" in
1395 GALLIUM_STATE_TRACKERS_DIRS=""
1398 # look at what else is built
1399 case "$mesa_driver" in
1401 GALLIUM_STATE_TRACKERS_DIRS=glx
1404 GALLIUM_STATE_TRACKERS_DIRS="dri"
1406 # Have only tested st/xorg on 1.6.0 servers
1407 PKG_CHECK_MODULES(XORG, [xorg-server >= 1.6.0 libdrm >= $LIBDRM_XORG_REQUIRED libkms >= $LIBKMS_XORG_REQUIRED],
1408 HAVE_ST_XORG="yes"; GALLIUM_STATE_TRACKERS_DIRS="$GALLIUM_STATE_TRACKERS_DIRS xorg",
1413 if test "x$enable_egl" = xyes; then
1414 if test "$enable_openvg" = yes; then
1415 GALLIUM_STATE_TRACKERS_DIRS="$GALLIUM_STATE_TRACKERS_DIRS vega"
1419 if test "$enable_gallium_egl" = yes; then
1420 GALLIUM_STATE_TRACKERS_DIRS="$GALLIUM_STATE_TRACKERS_DIRS egl"
1426 # verify the requested state tracker exist
1428 _state_trackers=`IFS=', '; echo $with_state_trackers`
1429 for tracker in $_state_trackers; do
1432 if test "x$mesa_driver" != xdri; then
1433 AC_MSG_ERROR([cannot build dri state tracker without mesa driver set to dri])
1438 if test "x$enable_egl" != xyes; then
1439 AC_MSG_ERROR([cannot build egl state tracker without EGL library])
1444 PKG_CHECK_MODULES([XORG], [xorg-server >= 1.6.0])
1445 PKG_CHECK_MODULES([LIBDRM_XORG], [libdrm >= $LIBDRM_XORG_REQUIRED])
1446 PKG_CHECK_MODULES([LIBKMS_XORG], [libkms >= $LIBKMS_XORG_REQUIRED])
1450 if test "x$enable_openvg" != xyes; then
1451 AC_MSG_ERROR([cannot build vega state tracker without --enable-openvg])
1457 if test -n "$tracker"; then
1458 test -d "$srcdir/src/gallium/state_trackers/$tracker" || \
1459 AC_MSG_ERROR([state tracker '$tracker' doesn't exist])
1460 if test -n "$state_trackers"; then
1461 state_trackers="$state_trackers $tracker"
1463 state_trackers="$tracker"
1467 GALLIUM_STATE_TRACKERS_DIRS="$state_trackers"
1469 # append --enable-openvg/--enable-gallium-egl to --with-state-trackers
1470 if test "x$have_st_vega" != xyes -a "x$enable_openvg" = xyes; then
1471 AC_MSG_ERROR([--with-state-trackers specified but vega is missing])
1473 if test "x$HAVE_ST_EGL" != xyes -a "x$enable_gallium_egl" = xyes; then
1474 AC_MSG_ERROR([--with-state-trackers specified but egl is missing])
1483 case "x$enable_opengl$enable_gles1$enable_gles2" in
1485 EGL_CLIENT_APIS="$EGL_CLIENT_APIS "'$(GL_LIB)'
1488 if test "x$enable_openvg" = xyes; then
1489 EGL_CLIENT_APIS="$EGL_CLIENT_APIS "'$(VG_LIB)'
1490 VG_LIB_DEPS="$VG_LIB_DEPS -lpthread"
1493 AC_SUBST([VG_LIB_DEPS])
1494 AC_SUBST([EGL_CLIENT_APIS])
1496 if test "x$HAVE_ST_EGL" = xyes; then
1497 GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS egl"
1500 if test "x$HAVE_ST_XORG" = xyes; then
1501 PKG_CHECK_MODULES(XEXT, [xextproto >= 7.0.99.1],
1502 HAVE_XEXTPROTO_71="yes"; DEFINES="$DEFINES -DHAVE_XEXTPROTO_71",
1503 HAVE_XEXTPROTO_71="no")
1506 AC_ARG_WITH([egl-platforms],
1507 [AS_HELP_STRING([--with-egl-platforms@<:@=DIRS...@:>@],
1508 [comma delimited native platforms libEGL supports, e.g.
1509 "x11,drm" @<:@default=auto@:>@])],
1510 [with_egl_platforms="$withval"],
1511 [with_egl_platforms=yes])
1512 AC_ARG_WITH([egl-displays],
1513 [AS_HELP_STRING([--with-egl-displays@<:@=DIRS...@:>@],
1514 [DEPRECATED. Use --with-egl-platforms instead])],
1515 [with_egl_platforms="$withval"])
1518 case "$with_egl_platforms" in
1520 if test "x$enable_egl" = xyes && test "x$mesa_driver" != xosmesa; then
1522 if test "$mesa_driver" = dri; then
1523 EGL_PLATFORMS="$EGL_PLATFORMS drm"
1528 if test "x$enable_egl" != xyes; then
1529 AC_MSG_ERROR([cannot build egl state tracker without EGL library])
1531 # verify the requested driver directories exist
1532 egl_platforms=`IFS=', '; echo $with_egl_platforms`
1533 for plat in $egl_platforms; do
1534 test -d "$srcdir/src/gallium/state_trackers/egl/$plat" || \
1535 AC_MSG_ERROR([EGL platform '$plat' does't exist])
1536 if test "$plat" = "fbdev"; then
1537 GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS sw/fbdev"
1540 EGL_PLATFORMS="$egl_platforms"
1543 AC_SUBST([EGL_PLATFORMS])
1545 AC_ARG_WITH([egl-driver-dir],
1546 [AS_HELP_STRING([--with-egl-driver-dir=DIR],
1547 [directory for EGL drivers [[default=${libdir}/egl]]])],
1548 [EGL_DRIVER_INSTALL_DIR="$withval"],
1549 [EGL_DRIVER_INSTALL_DIR='${libdir}/egl'])
1550 AC_SUBST([EGL_DRIVER_INSTALL_DIR])
1552 AC_ARG_WITH([xorg-driver-dir],
1553 [AS_HELP_STRING([--with-xorg-driver-dir=DIR],
1554 [Default xorg driver directory[[default=${libdir}/xorg/modules/drivers]]])],
1555 [XORG_DRIVER_INSTALL_DIR="$withval"],
1556 [XORG_DRIVER_INSTALL_DIR="${libdir}/xorg/modules/drivers"])
1557 AC_SUBST([XORG_DRIVER_INSTALL_DIR])
1559 AC_ARG_WITH([max-width],
1560 [AS_HELP_STRING([--with-max-width=N],
1561 [Maximum framebuffer width (4096)])],
1562 [DEFINES="${DEFINES} -DMAX_WIDTH=${withval}";
1563 AS_IF([test "${withval}" -gt "4096"],
1564 [AC_MSG_WARN([Large framebuffer: see s_tritemp.h comments.])])]
1566 AC_ARG_WITH([max-height],
1567 [AS_HELP_STRING([--with-max-height=N],
1568 [Maximum framebuffer height (4096)])],
1569 [DEFINES="${DEFINES} -DMAX_HEIGHT=${withval}";
1570 AS_IF([test "${withval}" -gt "4096"],
1571 [AC_MSG_WARN([Large framebuffer: see s_tritemp.h comments.])])]
1577 AC_ARG_ENABLE([gallium-llvm],
1578 [AS_HELP_STRING([--enable-gallium-llvm],
1579 [build gallium LLVM support @<:@default=disabled@:>@])],
1580 [enable_gallium_llvm="$enableval"],
1581 [enable_gallium_llvm=auto])
1582 if test "x$enable_gallium_llvm" = xyes; then
1583 if test "x$LLVM_CONFIG" != xno; then
1584 LLVM_VERSION=`$LLVM_CONFIG --version`
1585 LLVM_CFLAGS=`$LLVM_CONFIG --cppflags`
1586 LLVM_LIBS="`$LLVM_CONFIG --libs jit interpreter nativecodegen bitwriter` -lstdc++"
1588 if test "x$HAS_UDIS86" != xno; then
1589 LLVM_LIBS="$LLVM_LIBS -ludis86"
1590 DEFINES="$DEFINES -DHAVE_UDIS86"
1592 LLVM_LDFLAGS=`$LLVM_CONFIG --ldflags`
1593 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS llvmpipe"
1594 DEFINES="$DEFINES -DGALLIUM_LLVMPIPE -D__STDC_CONSTANT_MACROS"
1604 dnl Gallium helper functions
1606 gallium_check_st() {
1607 if test "x$HAVE_ST_DRI" = xyes || test "x$HAVE_ST_XORG" = xyes; then
1608 GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS $1"
1610 if test "x$HAVE_ST_DRI" = xyes && test "x$2" != x; then
1611 GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS $2"
1613 if test "x$HAVE_ST_XORG" = xyes && test "x$3" != x; then
1614 GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS $3"
1620 dnl Gallium SVGA configuration
1622 AC_ARG_ENABLE([gallium-svga],
1623 [AS_HELP_STRING([--enable-gallium-svga],
1624 [build gallium SVGA @<:@default=disabled@:>@])],
1625 [enable_gallium_svga="$enableval"],
1626 [enable_gallium_svga=auto])
1627 if test "x$enable_gallium_svga" = xyes; then
1628 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS svga"
1629 gallium_check_st "svga/drm" "dri-vmwgfx" "xorg-vmwgfx"
1630 elif test "x$enable_gallium_svga" = xauto; then
1631 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS svga"
1635 dnl Gallium i915 configuration
1637 AC_ARG_ENABLE([gallium-i915],
1638 [AS_HELP_STRING([--enable-gallium-i915],
1639 [build gallium i915 @<:@default=disabled@:>@])],
1640 [enable_gallium_i915="$enableval"],
1641 [enable_gallium_i915=auto])
1642 if test "x$enable_gallium_i915" = xyes; then
1643 GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS i915/sw"
1644 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS i915"
1645 gallium_check_st "i915/drm" "dri-i915" "xorg-i915"
1646 elif test "x$enable_gallium_i915" = xauto; then
1647 GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS i915/sw"
1648 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS i915"
1652 dnl Gallium i965 configuration
1654 AC_ARG_ENABLE([gallium-i965],
1655 [AS_HELP_STRING([--enable-gallium-i965],
1656 [build gallium i965 @<:@default=disabled@:>@])],
1657 [enable_gallium_i965="$enableval"],
1658 [enable_gallium_i965=auto])
1659 if test "x$enable_gallium_i965" = xyes; then
1660 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS i965"
1661 gallium_check_st "i965/drm" "dri-i965" "xorg-i965"
1662 elif test "x$enable_gallium_i965" = xauto; then
1663 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS i965"
1667 dnl Gallium Radeon r300g configuration
1669 AC_ARG_ENABLE([gallium-radeon],
1670 [AS_HELP_STRING([--enable-gallium-radeon],
1671 [build gallium radeon @<:@default=disabled@:>@])],
1672 [enable_gallium_radeon="$enableval"],
1673 [enable_gallium_radeon=auto])
1674 if test "x$enable_gallium_radeon" = xauto; then
1675 if test "x$HAVE_LIBDRM_RADEON" = xyes; then
1676 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r300"
1677 gallium_check_st "radeon/drm" "dri-r300"
1679 AC_MSG_WARN([libdrm_radeon is missing, not building gallium-radeon (r300)])
1682 if test "x$enable_gallium_radeon" = xyes; then
1683 if test "x$HAVE_LIBDRM_RADEON" = xyes; then
1684 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r300"
1685 gallium_check_st "radeon/drm" "dri-r300" "xorg-radeon"
1687 AC_MSG_ERROR([libdrm_radeon is missing, cannot build gallium-radeon (r300)])
1692 dnl Gallium Radeon r600g configuration
1694 AC_ARG_ENABLE([gallium-r600],
1695 [AS_HELP_STRING([--enable-gallium-r600],
1696 [build gallium radeon @<:@default=disabled@:>@])],
1697 [enable_gallium_r600="$enableval"],
1698 [enable_gallium_r600=auto])
1699 if test "x$enable_gallium_r600" = xyes; then
1700 if test "x$HAVE_LIBDRM_RADEON" = xyes; then
1701 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r600"
1702 gallium_check_st "r600/drm" "dri-r600"
1704 AC_MSG_ERROR([libdrm_radeon is missing, cannot build gallium-r600])
1709 dnl Gallium Nouveau configuration
1711 AC_ARG_ENABLE([gallium-nouveau],
1712 [AS_HELP_STRING([--enable-gallium-nouveau],
1713 [build gallium nouveau @<:@default=disabled@:>@])],
1714 [enable_gallium_nouveau="$enableval"],
1715 [enable_gallium_nouveau=no])
1716 if test "x$enable_gallium_nouveau" = xyes; then
1717 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS nouveau nvfx nv50 nvc0"
1718 gallium_check_st "nouveau/drm" "dri-nouveau" "xorg-nouveau"
1722 dnl Gallium swrast configuration
1724 AC_ARG_ENABLE([gallium-swrast],
1725 [AS_HELP_STRING([--enable-gallium-swrast],
1726 [build gallium swrast @<:@default=auto@:>@])],
1727 [enable_gallium_swrast="$enableval"],
1728 [enable_gallium_swrast=auto])
1729 if test "x$enable_gallium_swrast" = xyes || test "x$enable_gallium_swrast" = xauto; then
1730 if test "x$HAVE_ST_DRI" = xyes; then
1731 GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS dri-swrast"
1735 dnl prepend CORE_DIRS to SRC_DIRS
1736 SRC_DIRS="$CORE_DIRS $SRC_DIRS"
1738 dnl Restore LDFLAGS and CPPFLAGS
1739 LDFLAGS="$_SAVE_LDFLAGS"
1740 CPPFLAGS="$_SAVE_CPPFLAGS"
1742 dnl Substitute the config
1743 AC_CONFIG_FILES([configs/autoconf])
1745 dnl Replace the configs/current symlink
1746 AC_CONFIG_COMMANDS([configs],[
1747 if test -f configs/current || test -L configs/current; then
1748 rm -f configs/current
1750 ln -s autoconf configs/current
1756 dnl Output some configuration info for the user
1759 echo " prefix: $prefix"
1760 echo " exec_prefix: $exec_prefix"
1761 echo " libdir: $libdir"
1762 echo " includedir: $includedir"
1766 echo " OpenGL: $enable_opengl (ES1: $enable_gles1 ES2: $enable_gles2)"
1767 echo " OpenVG: $enable_openvg"
1771 echo " Driver: $mesa_driver"
1772 if test "$mesa_driver" != no; then
1773 if echo "$DRIVER_DIRS" | grep 'osmesa' >/dev/null 2>&1; then
1774 echo " OSMesa: lib$OSMESA_LIB"
1778 if test "$mesa_driver" = dri; then
1779 # cleanup the drivers var
1780 dri_dirs=`echo $DRI_DIRS | $SED 's/^ *//;s/ */ /;s/ *$//'`
1781 if test "x$DRI_DIRS" = x; then
1782 echo " DRI drivers: no"
1784 echo " DRI drivers: $dri_dirs"
1786 echo " DRI driver dir: $DRI_DRIVER_INSTALL_DIR"
1787 echo " Use XCB: $enable_xcb"
1791 echo " GLU: $enable_glu"
1792 echo " GLw: $enable_glw (Motif: $enable_motif)"
1793 echo " glut: $enable_glut"
1797 echo " EGL: $enable_egl"
1798 if test "$enable_egl" = yes; then
1799 echo " EGL platforms: $EGL_PLATFORMS"
1802 for d in $EGL_DRIVERS_DIRS; do
1803 egl_drivers="$egl_drivers builtin:egl_$d"
1806 if test "$enable_gallium" = yes -a "$HAVE_ST_EGL" = yes; then
1807 echo " EGL drivers: ${egl_drivers} egl_gallium"
1808 echo " EGL Gallium STs:$EGL_CLIENT_APIS"
1810 echo " EGL drivers: $egl_drivers"
1815 if test "x$MESA_LLVM" = x1; then
1817 echo " llvm-config: $LLVM_CONFIG"
1818 echo " llvm-version: $LLVM_VERSION"
1824 if echo "$SRC_DIRS" | grep 'gallium' >/dev/null 2>&1; then
1825 echo " Gallium: yes"
1826 echo " Gallium dirs: $GALLIUM_DIRS"
1827 echo " Target dirs: $GALLIUM_TARGET_DIRS"
1828 echo " Winsys dirs: $GALLIUM_WINSYS_DIRS"
1829 echo " Driver dirs: $GALLIUM_DRIVERS_DIRS"
1830 echo " Trackers dirs: $GALLIUM_STATE_TRACKERS_DIRS"
1837 echo " Shared libs: $enable_shared"
1838 echo " Static libs: $enable_static"
1840 dnl Compiler options
1841 # cleanup the CFLAGS/CXXFLAGS/DEFINES vars
1842 cflags=`echo $CFLAGS $OPT_FLAGS $PIC_FLAGS $ARCH_FLAGS | \
1843 $SED 's/^ *//;s/ */ /;s/ *$//'`
1844 cxxflags=`echo $CXXFLAGS $OPT_FLAGS $PIC_FLAGS $ARCH_FLAGS | \
1845 $SED 's/^ *//;s/ */ /;s/ *$//'`
1846 defines=`echo $DEFINES $ASM_FLAGS | $SED 's/^ *//;s/ */ /;s/ *$//'`
1848 echo " CFLAGS: $cflags"
1849 echo " CXXFLAGS: $cxxflags"
1850 echo " Macros: $defines"
1852 echo " PYTHON2: $PYTHON2"
1855 echo " Run '${MAKE-make}' to build Mesa"