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'])])
8 m4_ifval(mesa_version,[],[
9 m4_errprint([Error: Failed to get the Mesa version from the output of
10 running `make -f bin/version.mk version'
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
22 DRI2PROTO_REQUIRED=1.1
28 AC_CHECK_PROGS([MAKE], [gmake make])
29 AC_PATH_PROG([MKDEP], [makedepend])
30 AC_PATH_PROG([SED], [sed])
32 dnl Platform-specific program settings
34 AC_SUBST([EXTRA_CONFIG_LINES])
37 # Solaris /bin/sh is too old/non-POSIX compliant
38 AC_PATH_PROGS(POSIX_SHELL, [ksh93 ksh sh])
39 EXTRA_CONFIG_LINES="SHELL=$POSIX_SHELL"
44 MKDEP_OPTIONS=-fdepend
45 dnl Ask gcc where it's keeping its secret headers
46 if test "x$GCC" = xyes; then
47 GCC_INCLUDES=`$CC -print-file-name=include`
48 if test "x$GCC_INCLUDES" != x; then
49 MKDEP_OPTIONS="$MKDEP_OPTIONS -I$GCC_INCLUDES"
52 AC_SUBST([MKDEP_OPTIONS])
54 dnl Make sure the pkg-config macros are defined
55 m4_ifdef([PKG_PROG_PKG_CONFIG],[],[
56 m4_errprint([Error: Could not locate the pkg-config autoconf macros.
57 These are usually located in /usr/share/aclocal/pkg.m4. If your
58 macros are in a different location, try setting the environment
59 variable ACLOCAL="aclocal -I/other/macro/dir" before running
66 dnl LIB_DIR - library basename
67 LIB_DIR=`echo $libdir | $SED 's%.*/%%'`
70 dnl Cache LDFLAGS so we can add EXTRA_LIB_PATH and restore it later
71 _SAVE_LDFLAGS="$LDFLAGS"
72 AC_ARG_VAR([EXTRA_LIB_PATH],[Extra -L paths for the linker])
73 AC_SUBST([EXTRA_LIB_PATH])
75 dnl Cache CPPFLAGS so we can add *_INCLUDES and restore it later
76 _SAVE_CPPFLAGS="$CPPFLAGS"
77 AC_ARG_VAR([X11_INCLUDES],[Extra -I paths for X11 headers])
78 AC_SUBST([X11_INCLUDES])
85 if test "x$GCC" = xyes; then
86 DEFINES="$DEFINES -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_BSD_SOURCE"
88 DEFINES="$DEFINES -D_SVID_SOURCE -D_GNU_SOURCE -DPTHREADS -DHAVE_POSIX_MEMALIGN"
91 DEFINES="$DEFINES -DPTHREADS -DSVR4"
95 dnl Add flags for gcc and g++
96 if test "x$GCC" = xyes; then
97 CFLAGS="$CFLAGS -Wall -Wmissing-prototypes -std=c99 -ffast-math"
99 # Work around aliasing bugs - developers should comment this out
100 CFLAGS="$CFLAGS -fno-strict-aliasing"
102 if test "x$GXX" = xyes; then
103 CXXFLAGS="$CXXFLAGS -Wall"
105 # Work around aliasing bugs - developers should comment this out
106 CXXFLAGS="$CXXFLAGS -fno-strict-aliasing"
109 dnl These should be unnecessary, but let the user set them if they want
110 AC_ARG_VAR([OPT_FLAGS], [Additional optimization flags for the compiler.
111 Default is to use CFLAGS.])
112 AC_ARG_VAR([ARCH_FLAGS], [Additional architecture specific flags for the
113 compiler. Default is to use CFLAGS.])
114 AC_SUBST([OPT_FLAGS])
115 AC_SUBST([ARCH_FLAGS])
118 dnl Hacks to enable 32 or 64 bit build
120 AC_ARG_ENABLE([32-bit],
121 [AS_HELP_STRING([--enable-32-bit],
122 [build 32-bit libraries @<:@default=auto@:>@])],
123 [enable_32bit="$enableval"],
126 if test "x$enable_32bit" = xyes; then
127 if test "x$GCC" = xyes; then
128 CFLAGS="$CFLAGS -m32"
130 if test "x$GXX" = xyes; then
131 CXXFLAGS="$CXXFLAGS -m32"
134 AC_ARG_ENABLE([64-bit],
135 [AS_HELP_STRING([--enable-64-bit],
136 [build 64-bit libraries @<:@default=auto@:>@])],
137 [enable_64bit="$enableval"],
140 if test "x$enable_64bit" = xyes; then
141 if test "x$GCC" = xyes; then
142 CFLAGS="$CFLAGS -m64"
144 if test "x$GXX" = xyes; then
145 CXXFLAGS="$CXXFLAGS -m64"
150 dnl shared/static libraries, mimic libtool options
152 AC_ARG_ENABLE([static],
153 [AS_HELP_STRING([--enable-static],
154 [build static libraries @<:@default=disabled@:>@])],
155 [enable_static="$enableval"],
158 case "x$enable_static" in
160 x ) enable_static=no ;;
162 AC_MSG_ERROR([Static library option '$enable_static' is not a valid])
165 AC_ARG_ENABLE([shared],
166 [AS_HELP_STRING([--disable-shared],
167 [build shared libraries @<:@default=enabled@:>@])],
168 [enable_shared="$enableval"],
171 case "x$enable_shared" in
173 x ) enable_shared=yes ;;
175 AC_MSG_ERROR([Shared library option '$enable_shared' is not a valid])
179 dnl Can't have static and shared libraries, default to static if user
180 dnl explicitly requested. If both disabled, set to static since shared
181 dnl was explicitly requirested.
182 case "x$enable_static$enable_shared" in
184 AC_MSG_WARN([Can't build static and shared libraries, disabling shared])
188 AC_MSG_WARN([Can't disable both static and shared libraries, enabling static])
196 AC_ARG_VAR([MKLIB_OPTIONS],[Options for the Mesa library script, mklib])
197 if test "$enable_static" = yes; then
198 MKLIB_OPTIONS="$MKLIB_OPTIONS -static"
200 AC_SUBST([MKLIB_OPTIONS])
203 dnl other compiler options
205 AC_ARG_ENABLE([debug],
206 [AS_HELP_STRING([--enable-debug],
207 [use debug compiler flags and macros @<:@default=disabled@:>@])],
208 [enable_debug="$enableval"],
211 if test "x$enable_debug" = xyes; then
212 DEFINES="$DEFINES -DDEBUG"
213 if test "x$GCC" = xyes; then
216 if test "x$GXX" = xyes; then
217 CXXFLAGS="$CXXFLAGS -g"
224 if test "$enable_static" = yes; then
225 GL_LIB_NAME='lib$(GL_LIB).a'
226 GLU_LIB_NAME='lib$(GLU_LIB).a'
227 GLUT_LIB_NAME='lib$(GLUT_LIB).a'
228 GLW_LIB_NAME='lib$(GLW_LIB).a'
229 OSMESA_LIB_NAME='lib$(OSMESA_LIB).a'
231 GL_LIB_NAME='lib$(GL_LIB).so'
232 GLU_LIB_NAME='lib$(GLU_LIB).so'
233 GLUT_LIB_NAME='lib$(GLUT_LIB).so'
234 GLW_LIB_NAME='lib$(GLW_LIB).so'
235 OSMESA_LIB_NAME='lib$(OSMESA_LIB).so'
237 AC_SUBST([GL_LIB_NAME])
238 AC_SUBST([GLU_LIB_NAME])
239 AC_SUBST([GLUT_LIB_NAME])
240 AC_SUBST([GLW_LIB_NAME])
241 AC_SUBST([OSMESA_LIB_NAME])
244 dnl Arch/platform-specific settings
247 [AS_HELP_STRING([--disable-asm],
248 [disable assembly usage @<:@default=enabled on supported plaforms@:>@])],
249 [enable_asm="$enableval"],
256 AC_MSG_CHECKING([whether to enable assembly])
257 test "x$enable_asm" = xno && AC_MSG_RESULT([no])
258 # disable if cross compiling on x86/x86_64 since we must run gen_matypes
259 if test "x$enable_asm" = xyes && test "x$cross_compiling" = xyes; then
263 AC_MSG_RESULT([no, cross compiling])
267 # check for supported arches
268 if test "x$enable_asm" = xyes; then
272 linux* | freebsd* | dragonfly*)
273 test "x$enable_64bit" = xyes && asm_arch=x86_64 || asm_arch=x86
279 linux* | freebsd* | dragonfly*)
280 test "x$enable_32bit" = xyes && asm_arch=x86 || asm_arch=x86_64
295 ASM_FLAGS="-DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM"
296 ASM_SOURCES='$(X86_SOURCES)'
298 AC_MSG_RESULT([yes, x86])
301 ASM_FLAGS="-DUSE_X86_64_ASM"
302 ASM_SOURCES='$(X86-64_SOURCES)'
303 ASM_API='$(X86-64_API)'
304 AC_MSG_RESULT([yes, x86_64])
307 ASM_FLAGS="-DUSE_PPC_ASM -DUSE_VMX_ASM"
308 ASM_SOURCES='$(PPC_SOURCES)'
309 AC_MSG_RESULT([yes, ppc])
312 AC_MSG_RESULT([no, platform not supported])
316 AC_SUBST([ASM_FLAGS])
317 AC_SUBST([ASM_SOURCES])
323 dnl Check to see if dlopen is in default libraries (like Solaris, which
324 dnl has it in libc), or if libdl is needed to get it.
325 AC_CHECK_FUNC([dlopen], [],
326 [AC_CHECK_LIB([dl], [dlopen], [DLOPEN_LIBS="-ldl"])])
328 dnl SELinux awareness.
329 AC_ARG_ENABLE([selinux],
330 [AS_HELP_STRING([--enable-selinux],
331 [Build SELinux-aware Mesa @<:@default=disabled@:>@])],
332 [MESA_SELINUX="$enableval"],
334 if test "x$enable_selinux" = "xyes"; then
335 AC_CHECK_HEADER([selinux/selinux.h],[],
336 [AC_MSG_ERROR([SELinux headers not found])])
337 AC_CHECK_LIB([selinux],[is_selinux_enabled],[],
338 [AC_MSG_ERROR([SELinux library not found])])
339 SELINUX_LIBS="-lselinux"
340 DEFINES="$DEFINES -DMESA_SELINUX"
343 dnl OS-specific libraries
348 if test "x$GXX" != xyes; then
349 OS_CPLUSPLUS_LIBS="-lCrun $OS_LIBS"
355 dnl Driver configuration. Options are xlib, dri and osmesa right now.
356 dnl More later: directfb, fbdev, ...
358 default_driver="xlib"
363 i*86|x86_64|powerpc*) default_driver="dri";;
366 freebsd* | dragonfly*)
368 i*86|x86_64) default_driver="dri";;
373 AC_ARG_WITH([driver],
374 [AS_HELP_STRING([--with-driver=DRIVER],
375 [driver for Mesa: xlib,dri,osmesa @<:@default=dri when available, or xlib@:>@])],
376 [mesa_driver="$withval"],
377 [mesa_driver="$default_driver"])
378 dnl Check for valid option
379 case "x$mesa_driver" in
383 AC_MSG_ERROR([Driver '$mesa_driver' is not a valid option])
388 dnl Driver specific build directories
393 case "$mesa_driver" in
398 SRC_DIRS="glx/x11 $SRC_DIRS"
408 AC_SUBST([DRIVER_DIRS])
409 AC_SUBST([WINDOW_SYSTEM])
412 dnl User supplied program configuration
414 if test -d "$srcdir/progs/demos"; then
420 [AS_HELP_STRING([--with-demos@<:@=DIRS...@:>@],
421 [optional comma delimited demo directories to build
422 @<:@default=auto if source available@:>@])],
423 [with_demos="$withval"],
424 [with_demos="$default_demos"])
425 if test "x$with_demos" = x; then
429 dnl If $with_demos is yes, directories will be added as libs available
431 case "$with_demos" in
434 # If the driver isn't osmesa, we have libGL and can build xdemos
435 if test "$mesa_driver" != osmesa; then
436 PROGRAM_DIRS="xdemos"
440 # verify the requested demos directories exist
441 demos=`IFS=,; echo $with_demos`
442 for demo in $demos; do
443 test -d "$srcdir/progs/$demo" || \
444 AC_MSG_ERROR([Program directory '$demo' doesn't exist])
446 PROGRAM_DIRS="$demos"
451 dnl Find out if X is available. The variable have_x is set if libX11 is
452 dnl to mimic AC_PATH_XTRA.
454 if test -n "$PKG_CONFIG"; then
455 AC_MSG_CHECKING([pkg-config files for X11 are available])
456 PKG_CHECK_EXISTS([x11],[
462 AC_MSG_RESULT([$x11_pkgconfig])
466 dnl Use the autoconf macro if no pkg-config files
467 if test "$x11_pkgconfig" = no; then
471 dnl We need X for xlib and dri, so bomb now if it's not found
472 case "$mesa_driver" in
474 if test "$no_x" = yes; then
475 AC_MSG_ERROR([X11 development libraries needed for $mesa_driver driver])
480 dnl XCB - this is only used for GLX right now
482 [AS_HELP_STRING([--enable-xcb],
483 [use XCB for GLX @<:@default=disabled@:>@])],
484 [enable_xcb="$enableval"],
486 if test "x$enable_xcb" = xyes; then
487 DEFINES="$DEFINES -DUSE_XCB"
493 dnl libGL configuration per driver
495 case "$mesa_driver" in
497 if test "$x11_pkgconfig" = yes; then
498 PKG_CHECK_MODULES([XLIBGL], [x11 xext])
499 X11_INCLUDES="$X11_INCLUDES $XLIBGL_CFLAGS"
500 GL_LIB_DEPS="$XLIBGL_LIBS"
502 # should check these...
503 X11_INCLUDES="$X11_INCLUDES $X_CFLAGS"
504 GL_LIB_DEPS="$X_LIBS -lX11 -lXext"
506 GL_LIB_DEPS="$GL_LIB_DEPS $SELINUX_LIBS -lm -lpthread $OS_LIBS"
508 # if static, move the external libraries to the programs
509 # and empty the libraries for libGL
510 if test "$enable_static" = yes; then
511 APP_LIB_DEPS="$APP_LIB_DEPS $GL_LIB_DEPS"
516 # DRI must be shared, I think
517 if test "$enable_static" = yes; then
518 AC_MSG_ERROR([Can't use static libraries for DRI drivers])
522 PKG_CHECK_MODULES([LIBDRM], [libdrm >= $LIBDRM_REQUIRED])
523 PKG_CHECK_MODULES([DRI2PROTO], [dri2proto >= $DRI2PROTO_REQUIRED])
525 # find the DRI deps for libGL
526 if test "$x11_pkgconfig" = yes; then
527 # add xcb modules if necessary
528 dri_modules="x11 xext xxf86vm xdamage xfixes"
529 if test "$enable_xcb" = yes; then
530 dri_modules="$dri_modules x11-xcb xcb-glx"
533 PKG_CHECK_MODULES([DRIGL], [$dri_modules])
534 X11_INCLUDES="$X11_INCLUDES $DRIGL_CFLAGS"
535 GL_LIB_DEPS="$DRIGL_LIBS"
537 # should check these...
538 X11_INCLUDES="$X11_INCLUDES $X_CFLAGS"
539 GL_LIB_DEPS="$X_LIBS -lX11 -lXext -lXxf86vm -lXdamage -lXfixes"
541 # XCB can only be used from pkg-config
542 if test "$enable_xcb" = yes; then
543 PKG_CHECK_MODULES([XCB],[x11-xcb xcb-glx])
544 X11_INCLUDES="$X11_INCLUDES $XCB_CFLAGS"
545 GL_LIB_DEPS="$GL_LIB_DEPS $XCB_LIBS"
549 # need DRM libs, -lpthread, etc.
550 GL_LIB_DEPS="$GL_LIB_DEPS $LIBDRM_LIBS -lm -lpthread $DLOPEN_LIBS $OS_LIBS"
553 # No libGL for osmesa
554 GL_LIB_DEPS="$OS_LIBS"
557 AC_SUBST([GL_LIB_DEPS])
562 if test "$mesa_driver" = xlib; then
563 DEFINES="$DEFINES -DUSE_XSHM"
569 AC_ARG_ENABLE([glx-tls],
570 [AS_HELP_STRING([--enable-glx-tls],
571 [enable TLS support in GLX @<:@default=disabled@:>@])],
572 [GLX_USE_TLS="$enableval"],
574 dnl Directory for DRI drivers
575 AC_ARG_WITH([dri-driverdir],
576 [AS_HELP_STRING([--with-dri-driverdir=DIR],
577 [directory for the DRI drivers @<:@${libdir}/dri@:>@])],
578 [DRI_DRIVER_INSTALL_DIR="$withval"],
579 [DRI_DRIVER_INSTALL_DIR='${libdir}/dri'])
580 AC_SUBST([DRI_DRIVER_INSTALL_DIR])
581 dnl Direct rendering or just indirect rendering
582 AC_ARG_ENABLE([driglx-direct],
583 [AS_HELP_STRING([--disable-driglx-direct],
584 [enable direct rendering in GLX for DRI @<:@default=enabled@:>@])],
585 [driglx_direct="$enableval"],
586 [driglx_direct="yes"])
588 AC_ARG_ENABLE([ttm-api],
589 [AS_HELP_STRING([--enable-ttm-api],
590 [enable TTM API users @<:@default=disabled@:>@])],
591 [ttmapi="$enableval"],
594 if test "x$ttmapi" = "xyes"; then
596 CFLAGS=$LIBDRM_CFLAGS
597 AC_CHECK_HEADERS([xf86mm.h],[],[AC_MSG_ERROR([xf86mm.h required for TTM.])],[#include "stdint.h"\n#include "drm.h"])
601 dnl Which drivers to build - default is chosen by platform
602 AC_ARG_WITH([dri-drivers],
603 [AS_HELP_STRING([--with-dri-drivers@<:@=DIRS...@:>@],
604 [comma delimited DRI drivers, e.g. "i965,radeon,nouveau" @<:@default=auto@:>@])],
605 [with_dri_drivers="$withval"],
606 [with_dri_drivers=yes])
607 if test "x$with_dri_drivers" = x; then
611 dnl If $with_dri_drivers is yes, directories will be added through
614 case "$with_dri_drivers" in
617 # verify the requested driver directories exist
618 dri_drivers=`IFS=,; echo $with_dri_drivers`
619 for driver in $dri_drivers; do
620 test -d "$srcdir/src/mesa/drivers/dri/$driver" || \
621 AC_MSG_ERROR([DRI driver directory '$driver' doesn't exist])
623 DRI_DIRS="$dri_drivers"
627 dnl Just default to no EGL for now
629 AC_SUBST([USING_EGL])
631 dnl Set DRI_DIRS, DEFINES and LIB_DEPS
632 if test "$mesa_driver" = dri; then
634 if test "x$GLX_USE_TLS" = xyes; then
635 DEFINES="$DEFINES -DGLX_USE_TLS -DPTHREADS"
638 if test "x$ttmapi" = xyes; then
639 DEFINES="$DEFINES -DTTM_API"
642 if test "x$USING_EGL" = x1; then
646 # Platform specific settings and drivers to build
649 DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
650 DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING -DHAVE_ALIAS"
651 if test "x$driglx_direct" = xyes; then
652 DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
657 # ffb, gamma, and sis are missing because they have not be
658 # converted to use the new interface. i810 are missing
659 # because there is no x86-64 system where they could *ever*
661 if test "x$DRI_DIRS" = x; then
662 DRI_DIRS="i915 i965 mach64 mga r128 r200 r300 radeon \
663 savage tdfx unichrome swrast"
667 # Build only the drivers for cards that exist on PowerPC.
668 # At some point MGA will be added, but not yet.
669 if test "x$DRI_DIRS" = x; then
670 DRI_DIRS="mach64 r128 r200 r300 radeon tdfx swrast"
674 # Build only the drivers for cards that exist on sparc`
675 if test "x$DRI_DIRS" = x; then
676 DRI_DIRS="mach64 r128 r200 r300 radeon ffb swrast"
681 freebsd* | dragonfly*)
682 DEFINES="$DEFINES -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1"
683 DEFINES="$DEFINES -DIN_DRI_DRIVER -DHAVE_ALIAS"
684 DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING"
685 if test "x$driglx_direct" = xyes; then
686 DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
688 if test "x$GXX" = xyes; then
689 CXXFLAGS="$CXXFLAGS -ansi -pedantic"
692 # ffb and gamma are missing because they have not been converted
693 # to use the new interface.
694 if test "x$DRI_DIRS" = x; then
695 DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 radeon tdfx \
696 unichrome savage sis swrast"
700 DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
701 DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING"
702 if test "x$driglx_direct" = xyes; then
703 DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
709 if test "x$DRI_DIRS" = x; then
710 DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 radeon s3v \
711 savage sis tdfx trident unichrome ffb swrast"
714 DRI_DIRS=`echo "$DRI_DIRS" | $SED 's/ */ /g'`
720 [AS_HELP_STRING([--with-expat=DIR],
721 [expat install directory])],[
722 EXPAT_INCLUDES="-I$withval/include"
723 CPPFLAGS="$CPPFLAGS $EXPAT_INCLUDES"
724 LDFLAGS="$LDFLAGS -L$withval/$LIB_DIR"
725 EXPAT_LIB="-L$withval/$LIB_DIR -lexpat"
727 AC_CHECK_HEADER([expat.h],[],[AC_MSG_ERROR([Expat required for DRI.])])
728 AC_CHECK_LIB([expat],[XML_ParserCreate],[],
729 [AC_MSG_ERROR([Expat required for DRI.])])
731 # put all the necessary libs together
732 DRI_LIB_DEPS="$SELINUX_LIBS $LIBDRM_LIBS $EXPAT_LIB -lm -lpthread $DLOPEN_LIBS"
735 AC_SUBST([EXPAT_INCLUDES])
736 AC_SUBST([DRI_LIB_DEPS])
739 dnl OSMesa configuration
741 if test "$mesa_driver" = xlib; then
742 default_gl_osmesa=yes
746 AC_ARG_ENABLE([gl-osmesa],
747 [AS_HELP_STRING([--enable-gl-osmesa],
748 [enable OSMesa on libGL @<:@default=enabled for xlib driver@:>@])],
749 [gl_osmesa="$enableval"],
750 [gl_osmesa="$default_gl_osmesa"])
751 if test "x$gl_osmesa" = xyes; then
752 if test "$mesa_driver" = osmesa; then
753 AC_MSG_ERROR([libGL is not available for OSMesa driver])
755 DRIVER_DIRS="$DRIVER_DIRS osmesa"
759 dnl Configure the channel bits for OSMesa (libOSMesa, libOSMesa16, ...)
760 AC_ARG_WITH([osmesa-bits],
761 [AS_HELP_STRING([--with-osmesa-bits=BITS],
762 [OSMesa channel bits and library name: 8, 16, 32 @<:@default=8@:>@])],
763 [osmesa_bits="$withval"],
765 if test "$mesa_driver" != osmesa && test "x$osmesa_bits" != x8; then
766 AC_MSG_WARN([Ignoring OSMesa channel bits for non-OSMesa driver])
769 case "x$osmesa_bits" in
774 OSMESA_LIB="OSMesa$osmesa_bits"
775 DEFINES="$DEFINES -DCHAN_BITS=$osmesa_bits -DDEFAULT_SOFTWARE_DEPTH_BITS=31"
778 AC_MSG_ERROR([OSMesa bits '$osmesa_bits' is not a valid option])
781 AC_SUBST([OSMESA_LIB])
783 case "$mesa_driver" in
785 # only link libraries with osmesa if shared
786 if test "$enable_static" = no; then
787 OSMESA_LIB_DEPS="-lm -lpthread $SELINUX_LIBS"
794 # Link OSMesa to libGL otherwise
796 # only link libraries with osmesa if shared
797 if test "$enable_static" = no; then
798 OSMESA_MESA_DEPS='-l$(GL_LIB)'
804 if test "$enable_static" = no; then
805 OSMESA_LIB_DEPS="$OSMESA_LIB_DEPS $OS_LIBS"
807 AC_SUBST([OSMESA_LIB_DEPS])
808 AC_SUBST([OSMESA_MESA_DEPS])
811 dnl GLU configuration
814 [AS_HELP_STRING([--disable-glu],
815 [enable OpenGL Utility library @<:@default=enabled@:>@])],
816 [enable_glu="$enableval"],
818 if test "x$enable_glu" = xyes; then
819 SRC_DIRS="$SRC_DIRS glu"
821 case "$mesa_driver" in
823 # If GLU is available and we have libOSMesa (not 16 or 32),
824 # we can build the osdemos
825 if test "$with_demos" = yes && test "$osmesa_bits" = 8; then
826 PROGRAM_DIRS="$PROGRAM_DIRS osdemos"
829 # Link libGLU to libOSMesa instead of libGL
831 if test "$enable_static" = no; then
832 GLU_MESA_DEPS='-l$(OSMESA_LIB)'
838 # If static, empty GLU_LIB_DEPS and add libs for programs to link
839 if test "$enable_static" = no; then
841 GLU_MESA_DEPS='-l$(GL_LIB)'
845 APP_LIB_DEPS="$APP_LIB_DEPS -lstdc++"
850 if test "$enable_static" = no; then
851 GLU_LIB_DEPS="$GLU_LIB_DEPS $OS_CPLUSPLUS_LIBS"
853 AC_SUBST([GLU_LIB_DEPS])
854 AC_SUBST([GLU_MESA_DEPS])
857 dnl GLw configuration
860 [AS_HELP_STRING([--disable-glw],
861 [enable Xt/Motif widget library @<:@default=enabled@:>@])],
862 [enable_glw="$enableval"],
864 dnl Don't build GLw on osmesa
865 if test "x$enable_glw" = xyes && test "$mesa_driver" = osmesa; then
866 AC_MSG_WARN([Disabling GLw since the driver is OSMesa])
869 if test "x$enable_glw" = xyes; then
870 SRC_DIRS="$SRC_DIRS glw"
871 if test "$x11_pkgconfig" = yes; then
872 PKG_CHECK_MODULES([GLW],[x11 xt])
873 GLW_LIB_DEPS="$GLW_LIBS"
875 # should check these...
876 GLW_LIB_DEPS="$X_LIBS -lX11 -lXt"
879 # If static, empty GLW_LIB_DEPS and add libs for programs to link
880 if test "$enable_static" = no; then
881 GLW_MESA_DEPS='-l$(GL_LIB)'
882 GLW_LIB_DEPS="$GLW_LIB_DEPS $OS_LIBS"
884 APP_LIB_DEPS="$APP_LIB_DEPS $GLW_LIB_DEPS"
889 AC_SUBST([GLW_LIB_DEPS])
890 AC_SUBST([GLW_MESA_DEPS])
893 dnl GLUT configuration
895 if test -f "$srcdir/include/GL/glut.h"; then
900 AC_ARG_ENABLE([glut],
901 [AS_HELP_STRING([--disable-glut],
902 [enable GLUT library @<:@default=enabled if source available@:>@])],
903 [enable_glut="$enableval"],
904 [enable_glut="$default_glut"])
906 dnl Can't build glut if GLU not available
907 if test "x$enable_glu$enable_glut" = xnoyes; then
908 AC_MSG_WARN([Disabling glut since GLU is disabled])
911 dnl Don't build glut on osmesa
912 if test "x$enable_glut" = xyes && test "$mesa_driver" = osmesa; then
913 AC_MSG_WARN([Disabling glut since the driver is OSMesa])
917 if test "x$enable_glut" = xyes; then
918 SRC_DIRS="$SRC_DIRS glut/glx"
920 if test "x$GCC" = xyes; then
921 GLUT_CFLAGS="-fexceptions"
923 if test "$x11_pkgconfig" = yes; then
924 PKG_CHECK_MODULES([GLUT],[x11 xmu xi])
925 GLUT_LIB_DEPS="$GLUT_LIBS"
927 # should check these...
928 GLUT_LIB_DEPS="$X_LIBS -lX11 -lXmu -lXi"
930 GLUT_LIB_DEPS="$GLUT_LIB_DEPS -lm $OS_LIBS"
932 # If glut is available, we can build most programs
933 if test "$with_demos" = yes; then
934 PROGRAM_DIRS="$PROGRAM_DIRS demos redbook samples glsl"
937 # If static, empty GLUT_LIB_DEPS and add libs for programs to link
938 if test "$enable_static" = no; then
939 GLUT_MESA_DEPS='-l$(GLU_LIB) -l$(GL_LIB)'
941 APP_LIB_DEPS="$APP_LIB_DEPS $GLUT_LIB_DEPS"
946 AC_SUBST([GLUT_LIB_DEPS])
947 AC_SUBST([GLUT_MESA_DEPS])
948 AC_SUBST([GLUT_CFLAGS])
951 dnl Program library dependencies
952 dnl Only libm is added here if necessary as the libraries should
953 dnl be pulled in by the linker
955 if test "x$APP_LIB_DEPS" = x; then
958 APP_LIB_DEPS="-lX11 -lsocket -lnsl -lm"
965 AC_SUBST([APP_LIB_DEPS])
966 AC_SUBST([PROGRAM_DIRS])
969 dnl Restore LDFLAGS and CPPFLAGS
970 LDFLAGS="$_SAVE_LDFLAGS"
971 CPPFLAGS="$_SAVE_CPPFLAGS"
973 dnl Substitute the config
974 AC_CONFIG_FILES([configs/autoconf])
976 dnl Replace the configs/current symlink
977 AC_CONFIG_COMMANDS([configs],[
978 if test -f configs/current || test -L configs/current; then
979 rm -f configs/current
981 ln -s autoconf configs/current
987 dnl Output some configuration info for the user
990 echo " prefix: $prefix"
991 echo " exec_prefix: $exec_prefix"
992 echo " libdir: $libdir"
996 echo " Driver: $mesa_driver"
997 if echo "$DRIVER_DIRS" | grep 'osmesa' >/dev/null 2>&1; then
998 echo " OSMesa: lib$OSMESA_LIB"
1002 if test "$mesa_driver" = dri; then
1003 # cleanup the drivers var
1004 dri_dirs=`echo $DRI_DIRS | $SED 's/^ *//;s/ */ /;s/ *$//'`
1005 echo " DRI drivers: $dri_dirs"
1006 echo " DRI driver dir: $DRI_DRIVER_INSTALL_DIR"
1007 echo " TTM API support: $ttmapi"
1012 echo " Shared libs: $enable_shared"
1013 echo " Static libs: $enable_static"
1014 echo " GLU: $enable_glu"
1015 echo " GLw: $enable_glw"
1016 echo " glut: $enable_glut"
1019 # cleanup the programs var for display
1020 program_dirs=`echo $PROGRAM_DIRS | $SED 's/^ *//;s/ */ /;s/ *$//'`
1021 if test "x$program_dirs" = x; then
1024 echo " Demos: $program_dirs"
1027 dnl Compiler options
1028 # cleanup the CFLAGS/CXXFLAGS/DEFINES vars
1029 cflags=`echo $CFLAGS $OPT_FLAGS $PIC_FLAGS $ARCH_FLAGS | \
1030 $SED 's/^ *//;s/ */ /;s/ *$//'`
1031 cxxflags=`echo $CXXFLAGS $OPT_FLAGS $PIC_FLAGS $ARCH_FLAGS | \
1032 $SED 's/^ *//;s/ */ /;s/ *$//'`
1033 defines=`echo $DEFINES $ASM_FLAGS | $SED 's/^ *//;s/ */ /;s/ *$//'`
1035 echo " CFLAGS: $cflags"
1036 echo " CXXFLAGS: $cxxflags"
1037 echo " Macros: $defines"
1040 echo " Run '${MAKE-make}' to build Mesa"