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 dnl Tell the user about autoconf.html in the --help output
16 m4_divert_once([HELP_END], [
17 See docs/autoconf.html for more details on the options for Mesa.])
19 AC_INIT([Mesa],[mesa_version],
20 [https://bugs.freedesktop.org/enter_bug.cgi?product=Mesa])
21 AC_CONFIG_AUX_DIR([bin])
24 dnl Versions for external dependencies
26 DRI2PROTO_REQUIRED=1.1
32 AC_CHECK_PROGS([MAKE], [gmake make])
33 AC_PATH_PROG([MKDEP], [makedepend])
34 AC_PATH_PROG([SED], [sed])
36 dnl Platform-specific program settings
38 AC_SUBST([EXTRA_CONFIG_LINES])
41 # Solaris /bin/sh is too old/non-POSIX compliant
42 AC_PATH_PROGS(POSIX_SHELL, [ksh93 ksh sh])
43 EXTRA_CONFIG_LINES="SHELL=$POSIX_SHELL"
48 MKDEP_OPTIONS=-fdepend
49 dnl Ask gcc where it's keeping its secret headers
50 if test "x$GCC" = xyes; then
51 GCC_INCLUDES=`$CC -print-file-name=include`
52 if test "x$GCC_INCLUDES" != x; then
53 MKDEP_OPTIONS="$MKDEP_OPTIONS -I$GCC_INCLUDES"
56 AC_SUBST([MKDEP_OPTIONS])
58 dnl Make sure the pkg-config macros are defined
59 m4_ifdef([PKG_PROG_PKG_CONFIG],[],[
60 m4_errprint([Error: Could not locate the pkg-config autoconf macros.
61 These are usually located in /usr/share/aclocal/pkg.m4. If your
62 macros are in a different location, try setting the environment
63 variable ACLOCAL="aclocal -I/other/macro/dir" before running
70 dnl LIB_DIR - library basename
71 LIB_DIR=`echo $libdir | $SED 's%.*/%%'`
74 dnl Cache LDFLAGS so we can add EXTRA_LIB_PATH and restore it later
75 _SAVE_LDFLAGS="$LDFLAGS"
76 AC_ARG_VAR([EXTRA_LIB_PATH],[Extra -L paths for the linker])
77 AC_SUBST([EXTRA_LIB_PATH])
79 dnl Cache CPPFLAGS so we can add *_INCLUDES and restore it later
80 _SAVE_CPPFLAGS="$CPPFLAGS"
81 AC_ARG_VAR([X11_INCLUDES],[Extra -I paths for X11 headers])
82 AC_SUBST([X11_INCLUDES])
89 if test "x$GCC" = xyes; then
90 DEFINES="$DEFINES -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_BSD_SOURCE"
92 DEFINES="$DEFINES -D_SVID_SOURCE -D_GNU_SOURCE -DPTHREADS"
95 DEFINES="$DEFINES -DPTHREADS -DSVR4"
99 dnl Add flags for gcc and g++
100 if test "x$GCC" = xyes; then
101 CFLAGS="$CFLAGS -Wall -Wmissing-prototypes -std=c99 -ffast-math"
103 # Work around aliasing bugs - developers should comment this out
104 CFLAGS="$CFLAGS -fno-strict-aliasing"
106 if test "x$GXX" = xyes; then
107 CXXFLAGS="$CXXFLAGS -Wall"
109 # Work around aliasing bugs - developers should comment this out
110 CXXFLAGS="$CXXFLAGS -fno-strict-aliasing"
113 dnl These should be unnecessary, but let the user set them if they want
114 AC_ARG_VAR([OPT_FLAGS], [Additional optimization flags for the compiler.
115 Default is to use CFLAGS.])
116 AC_ARG_VAR([ARCH_FLAGS], [Additional architecture specific flags for the
117 compiler. Default is to use CFLAGS.])
118 AC_SUBST([OPT_FLAGS])
119 AC_SUBST([ARCH_FLAGS])
122 dnl Hacks to enable 32 or 64 bit build
124 AC_ARG_ENABLE([32-bit],
125 [AS_HELP_STRING([--enable-32-bit],
126 [build 32-bit libraries @<:@default=auto@:>@])],
127 [enable_32bit="$enableval"],
130 if test "x$enable_32bit" = xyes; then
131 if test "x$GCC" = xyes; then
132 CFLAGS="$CFLAGS -m32"
134 if test "x$GXX" = xyes; then
135 CXXFLAGS="$CXXFLAGS -m32"
138 AC_ARG_ENABLE([64-bit],
139 [AS_HELP_STRING([--enable-64-bit],
140 [build 64-bit libraries @<:@default=auto@:>@])],
141 [enable_64bit="$enableval"],
144 if test "x$enable_64bit" = xyes; then
145 if test "x$GCC" = xyes; then
146 CFLAGS="$CFLAGS -m64"
148 if test "x$GXX" = xyes; then
149 CXXFLAGS="$CXXFLAGS -m64"
154 dnl shared/static libraries, mimic libtool options
156 AC_ARG_ENABLE([static],
157 [AS_HELP_STRING([--enable-static],
158 [build static libraries @<:@default=disabled@:>@])],
159 [enable_static="$enableval"],
162 case "x$enable_static" in
164 x ) enable_static=no ;;
166 AC_MSG_ERROR([Static library option '$enable_static' is not a valid])
169 AC_ARG_ENABLE([shared],
170 [AS_HELP_STRING([--disable-shared],
171 [build shared libraries @<:@default=enabled@:>@])],
172 [enable_shared="$enableval"],
175 case "x$enable_shared" in
177 x ) enable_shared=yes ;;
179 AC_MSG_ERROR([Shared library option '$enable_shared' is not a valid])
183 dnl Can't have static and shared libraries, default to static if user
184 dnl explicitly requested. If both disabled, set to static since shared
185 dnl was explicitly requirested.
186 case "x$enable_static$enable_shared" in
188 AC_MSG_WARN([Can't build static and shared libraries, disabling shared])
192 AC_MSG_WARN([Can't disable both static and shared libraries, enabling static])
200 AC_ARG_VAR([MKLIB_OPTIONS],[Options for the Mesa library script, mklib])
201 if test "$enable_static" = yes; then
202 MKLIB_OPTIONS="$MKLIB_OPTIONS -static"
204 AC_SUBST([MKLIB_OPTIONS])
207 dnl other compiler options
209 AC_ARG_ENABLE([debug],
210 [AS_HELP_STRING([--enable-debug],
211 [use debug compiler flags and macros @<:@default=disabled@:>@])],
212 [enable_debug="$enableval"],
215 if test "x$enable_debug" = xyes; then
216 DEFINES="$DEFINES -DDEBUG"
217 if test "x$GCC" = xyes; then
220 if test "x$GXX" = xyes; then
221 CXXFLAGS="$CXXFLAGS -g"
228 if test "$enable_static" = yes; then
229 GL_LIB_NAME='lib$(GL_LIB).a'
230 GLU_LIB_NAME='lib$(GLU_LIB).a'
231 GLUT_LIB_NAME='lib$(GLUT_LIB).a'
232 GLW_LIB_NAME='lib$(GLW_LIB).a'
233 OSMESA_LIB_NAME='lib$(OSMESA_LIB).a'
235 GL_LIB_NAME='lib$(GL_LIB).so'
236 GLU_LIB_NAME='lib$(GLU_LIB).so'
237 GLUT_LIB_NAME='lib$(GLUT_LIB).so'
238 GLW_LIB_NAME='lib$(GLW_LIB).so'
239 OSMESA_LIB_NAME='lib$(OSMESA_LIB).so'
241 AC_SUBST([GL_LIB_NAME])
242 AC_SUBST([GLU_LIB_NAME])
243 AC_SUBST([GLUT_LIB_NAME])
244 AC_SUBST([GLW_LIB_NAME])
245 AC_SUBST([OSMESA_LIB_NAME])
248 dnl Arch/platform-specific settings
251 [AS_HELP_STRING([--disable-asm],
252 [disable assembly usage @<:@default=enabled on supported plaforms@:>@])],
253 [enable_asm="$enableval"],
260 AC_MSG_CHECKING([whether to enable assembly])
261 test "x$enable_asm" = xno && AC_MSG_RESULT([no])
262 # disable if cross compiling on x86/x86_64 since we must run gen_matypes
263 if test "x$enable_asm" = xyes && test "x$cross_compiling" = xyes; then
267 AC_MSG_RESULT([no, cross compiling])
271 # check for supported arches
272 if test "x$enable_asm" = xyes; then
276 linux* | freebsd* | dragonfly*)
277 test "x$enable_64bit" = xyes && asm_arch=x86_64 || asm_arch=x86
283 linux* | freebsd* | dragonfly*)
284 test "x$enable_32bit" = xyes && asm_arch=x86 || asm_arch=x86_64
299 ASM_FLAGS="-DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM"
300 ASM_SOURCES='$(X86_SOURCES)'
302 AC_MSG_RESULT([yes, x86])
305 ASM_FLAGS="-DUSE_X86_64_ASM"
306 ASM_SOURCES='$(X86-64_SOURCES)'
307 ASM_API='$(X86-64_API)'
308 AC_MSG_RESULT([yes, x86_64])
311 ASM_FLAGS="-DUSE_PPC_ASM -DUSE_VMX_ASM"
312 ASM_SOURCES='$(PPC_SOURCES)'
313 AC_MSG_RESULT([yes, ppc])
316 AC_MSG_RESULT([no, platform not supported])
320 AC_SUBST([ASM_FLAGS])
321 AC_SUBST([ASM_SOURCES])
327 dnl Check to see if dlopen is in default libraries (like Solaris, which
328 dnl has it in libc), or if libdl is needed to get it.
329 AC_CHECK_FUNC([dlopen], [],
330 [AC_CHECK_LIB([dl], [dlopen], [DLOPEN_LIBS="-ldl"])])
332 dnl See if posix_memalign is available
333 AC_CHECK_FUNC([posix_memalign], [DEFINES="$DEFINES -DHAVE_POSIX_MEMALIGN"])
335 dnl SELinux awareness.
336 AC_ARG_ENABLE([selinux],
337 [AS_HELP_STRING([--enable-selinux],
338 [Build SELinux-aware Mesa @<:@default=disabled@:>@])],
339 [MESA_SELINUX="$enableval"],
341 if test "x$enable_selinux" = "xyes"; then
342 AC_CHECK_HEADER([selinux/selinux.h],[],
343 [AC_MSG_ERROR([SELinux headers not found])])
344 AC_CHECK_LIB([selinux],[is_selinux_enabled],[],
345 [AC_MSG_ERROR([SELinux library not found])])
346 SELINUX_LIBS="-lselinux"
347 DEFINES="$DEFINES -DMESA_SELINUX"
350 dnl OS-specific libraries
355 if test "x$GXX" != xyes; then
356 OS_CPLUSPLUS_LIBS="-lCrun $OS_LIBS"
362 dnl Driver configuration. Options are xlib, dri and osmesa right now.
363 dnl More later: directfb, fbdev, ...
365 default_driver="xlib"
370 i*86|x86_64|powerpc*) default_driver="dri";;
373 freebsd* | dragonfly*)
375 i*86|x86_64) default_driver="dri";;
380 AC_ARG_WITH([driver],
381 [AS_HELP_STRING([--with-driver=DRIVER],
382 [driver for Mesa: xlib,dri,osmesa @<:@default=dri when available, or xlib@:>@])],
383 [mesa_driver="$withval"],
384 [mesa_driver="$default_driver"])
385 dnl Check for valid option
386 case "x$mesa_driver" in
390 AC_MSG_ERROR([Driver '$mesa_driver' is not a valid option])
395 dnl Driver specific build directories
400 case "$mesa_driver" in
405 SRC_DIRS="glx/x11 $SRC_DIRS"
415 AC_SUBST([DRIVER_DIRS])
416 AC_SUBST([WINDOW_SYSTEM])
419 dnl User supplied program configuration
421 if test -d "$srcdir/progs/demos"; then
427 [AS_HELP_STRING([--with-demos@<:@=DIRS...@:>@],
428 [optional comma delimited demo directories to build
429 @<:@default=auto if source available@:>@])],
430 [with_demos="$withval"],
431 [with_demos="$default_demos"])
432 if test "x$with_demos" = x; then
436 dnl If $with_demos is yes, directories will be added as libs available
438 case "$with_demos" in
441 # If the driver isn't osmesa, we have libGL and can build xdemos
442 if test "$mesa_driver" != osmesa; then
443 PROGRAM_DIRS="xdemos"
447 # verify the requested demos directories exist
448 demos=`IFS=,; echo $with_demos`
449 for demo in $demos; do
450 test -d "$srcdir/progs/$demo" || \
451 AC_MSG_ERROR([Program directory '$demo' doesn't exist])
453 PROGRAM_DIRS="$demos"
458 dnl Find out if X is available. The variable have_x is set if libX11 is
459 dnl found to mimic AC_PATH_XTRA.
461 if test -n "$PKG_CONFIG"; then
462 AC_MSG_CHECKING([pkg-config files for X11 are available])
463 PKG_CHECK_EXISTS([x11],[
469 AC_MSG_RESULT([$x11_pkgconfig])
473 dnl Use the autoconf macro if no pkg-config files
474 if test "$x11_pkgconfig" = no; then
478 dnl Try to tell the user that the --x-* options are only used when
479 dnl pkg-config is not available. This must be right after AC_PATH_XTRA.
480 m4_divert_once([HELP_BEGIN],
481 [These options are only used when the X libraries cannot be found by the
482 pkg-config utility.])
484 dnl We need X for xlib and dri, so bomb now if it's not found
485 case "$mesa_driver" in
487 if test "$no_x" = yes; then
488 AC_MSG_ERROR([X11 development libraries needed for $mesa_driver driver])
493 dnl XCB - this is only used for GLX right now
495 [AS_HELP_STRING([--enable-xcb],
496 [use XCB for GLX @<:@default=disabled@:>@])],
497 [enable_xcb="$enableval"],
499 if test "x$enable_xcb" = xyes; then
500 DEFINES="$DEFINES -DUSE_XCB"
506 dnl libGL configuration per driver
508 case "$mesa_driver" in
510 if test "$x11_pkgconfig" = yes; then
511 PKG_CHECK_MODULES([XLIBGL], [x11 xext])
512 X11_INCLUDES="$X11_INCLUDES $XLIBGL_CFLAGS"
513 GL_LIB_DEPS="$XLIBGL_LIBS"
515 # should check these...
516 X11_INCLUDES="$X11_INCLUDES $X_CFLAGS"
517 GL_LIB_DEPS="$X_LIBS -lX11 -lXext"
519 GL_LIB_DEPS="$GL_LIB_DEPS $SELINUX_LIBS -lm -lpthread $OS_LIBS"
521 # if static, move the external libraries to the programs
522 # and empty the libraries for libGL
523 if test "$enable_static" = yes; then
524 APP_LIB_DEPS="$APP_LIB_DEPS $GL_LIB_DEPS"
529 # DRI must be shared, I think
530 if test "$enable_static" = yes; then
531 AC_MSG_ERROR([Can't use static libraries for DRI drivers])
535 PKG_CHECK_MODULES([LIBDRM], [libdrm >= $LIBDRM_REQUIRED])
536 PKG_CHECK_MODULES([DRI2PROTO], [dri2proto >= $DRI2PROTO_REQUIRED])
538 # find the DRI deps for libGL
539 if test "$x11_pkgconfig" = yes; then
540 # add xcb modules if necessary
541 dri_modules="x11 xext xxf86vm xdamage xfixes"
542 if test "$enable_xcb" = yes; then
543 dri_modules="$dri_modules x11-xcb xcb-glx"
546 PKG_CHECK_MODULES([DRIGL], [$dri_modules])
547 X11_INCLUDES="$X11_INCLUDES $DRIGL_CFLAGS"
548 GL_LIB_DEPS="$DRIGL_LIBS"
550 # should check these...
551 X11_INCLUDES="$X11_INCLUDES $X_CFLAGS"
552 GL_LIB_DEPS="$X_LIBS -lX11 -lXext -lXxf86vm -lXdamage -lXfixes"
554 # XCB can only be used from pkg-config
555 if test "$enable_xcb" = yes; then
556 PKG_CHECK_MODULES([XCB],[x11-xcb xcb-glx])
557 X11_INCLUDES="$X11_INCLUDES $XCB_CFLAGS"
558 GL_LIB_DEPS="$GL_LIB_DEPS $XCB_LIBS"
562 # need DRM libs, -lpthread, etc.
563 GL_LIB_DEPS="$GL_LIB_DEPS $LIBDRM_LIBS -lm -lpthread $DLOPEN_LIBS $OS_LIBS"
566 # No libGL for osmesa
567 GL_LIB_DEPS="$OS_LIBS"
570 AC_SUBST([GL_LIB_DEPS])
575 if test "$mesa_driver" = xlib; then
576 DEFINES="$DEFINES -DUSE_XSHM"
582 AC_ARG_ENABLE([glx-tls],
583 [AS_HELP_STRING([--enable-glx-tls],
584 [enable TLS support in GLX @<:@default=disabled@:>@])],
585 [GLX_USE_TLS="$enableval"],
587 dnl Directory for DRI drivers
588 AC_ARG_WITH([dri-driverdir],
589 [AS_HELP_STRING([--with-dri-driverdir=DIR],
590 [directory for the DRI drivers @<:@${libdir}/dri@:>@])],
591 [DRI_DRIVER_INSTALL_DIR="$withval"],
592 [DRI_DRIVER_INSTALL_DIR='${libdir}/dri'])
593 AC_SUBST([DRI_DRIVER_INSTALL_DIR])
594 dnl Direct rendering or just indirect rendering
595 AC_ARG_ENABLE([driglx-direct],
596 [AS_HELP_STRING([--disable-driglx-direct],
597 [enable direct rendering in GLX for DRI @<:@default=enabled@:>@])],
598 [driglx_direct="$enableval"],
599 [driglx_direct="yes"])
601 AC_ARG_ENABLE([ttm-api],
602 [AS_HELP_STRING([--enable-ttm-api],
603 [enable TTM API users @<:@default=disabled@:>@])],
604 [ttmapi="$enableval"],
607 if test "x$ttmapi" = "xyes"; then
609 CFLAGS=$LIBDRM_CFLAGS
610 AC_CHECK_HEADERS([xf86mm.h],[],[AC_MSG_ERROR([xf86mm.h required for TTM.])],[#include "stdint.h"\n#include "drm.h"])
614 dnl Which drivers to build - default is chosen by platform
615 AC_ARG_WITH([dri-drivers],
616 [AS_HELP_STRING([--with-dri-drivers@<:@=DIRS...@:>@],
617 [comma delimited DRI drivers list, e.g.
618 "swrast,i965,radeon,nouveau" @<:@default=auto@:>@])],
619 [with_dri_drivers="$withval"],
620 [with_dri_drivers=yes])
621 if test "x$with_dri_drivers" = x; then
625 dnl If $with_dri_drivers is yes, directories will be added through
628 case "$with_dri_drivers" in
631 # verify the requested driver directories exist
632 dri_drivers=`IFS=', '; echo $with_dri_drivers`
633 for driver in $dri_drivers; do
634 test -d "$srcdir/src/mesa/drivers/dri/$driver" || \
635 AC_MSG_ERROR([DRI driver directory '$driver' doesn't exist])
637 DRI_DIRS="$dri_drivers"
641 dnl Just default to no EGL for now
643 AC_SUBST([USING_EGL])
645 dnl Set DRI_DIRS, DEFINES and LIB_DEPS
646 if test "$mesa_driver" = dri; then
648 if test "x$GLX_USE_TLS" = xyes; then
649 DEFINES="$DEFINES -DGLX_USE_TLS -DPTHREADS"
652 if test "x$ttmapi" = xyes; then
653 DEFINES="$DEFINES -DTTM_API"
656 if test "x$USING_EGL" = x1; then
660 # Platform specific settings and drivers to build
663 DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
664 DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING -DHAVE_ALIAS"
665 if test "x$driglx_direct" = xyes; then
666 DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
671 # ffb, gamma, and sis are missing because they have not be
672 # converted to use the new interface. i810 are missing
673 # because there is no x86-64 system where they could *ever*
675 if test "x$DRI_DIRS" = x; then
676 DRI_DIRS="i915 i965 mach64 mga r128 r200 r300 radeon \
677 savage tdfx unichrome swrast"
681 # Build only the drivers for cards that exist on PowerPC.
682 # At some point MGA will be added, but not yet.
683 if test "x$DRI_DIRS" = x; then
684 DRI_DIRS="mach64 r128 r200 r300 radeon tdfx swrast"
688 # Build only the drivers for cards that exist on sparc`
689 if test "x$DRI_DIRS" = x; then
690 DRI_DIRS="mach64 r128 r200 r300 radeon ffb swrast"
695 freebsd* | dragonfly*)
696 DEFINES="$DEFINES -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1"
697 DEFINES="$DEFINES -DIN_DRI_DRIVER -DHAVE_ALIAS"
698 DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING"
699 if test "x$driglx_direct" = xyes; then
700 DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
702 if test "x$GXX" = xyes; then
703 CXXFLAGS="$CXXFLAGS -ansi -pedantic"
706 # ffb and gamma are missing because they have not been converted
707 # to use the new interface.
708 if test "x$DRI_DIRS" = x; then
709 DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 radeon tdfx \
710 unichrome savage sis swrast"
714 DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
715 DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING"
716 if test "x$driglx_direct" = xyes; then
717 DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
723 if test "x$DRI_DIRS" = x; then
724 DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 radeon s3v \
725 savage sis tdfx trident unichrome ffb swrast"
728 DRI_DIRS=`echo "$DRI_DIRS" | $SED 's/ */ /g'`
734 [AS_HELP_STRING([--with-expat=DIR],
735 [expat install directory])],[
736 EXPAT_INCLUDES="-I$withval/include"
737 CPPFLAGS="$CPPFLAGS $EXPAT_INCLUDES"
738 LDFLAGS="$LDFLAGS -L$withval/$LIB_DIR"
739 EXPAT_LIB="-L$withval/$LIB_DIR -lexpat"
741 AC_CHECK_HEADER([expat.h],[],[AC_MSG_ERROR([Expat required for DRI.])])
742 AC_CHECK_LIB([expat],[XML_ParserCreate],[],
743 [AC_MSG_ERROR([Expat required for DRI.])])
745 # put all the necessary libs together
746 DRI_LIB_DEPS="$SELINUX_LIBS $LIBDRM_LIBS $EXPAT_LIB -lm -lpthread $DLOPEN_LIBS"
749 AC_SUBST([EXPAT_INCLUDES])
750 AC_SUBST([DRI_LIB_DEPS])
753 dnl OSMesa configuration
755 if test "$mesa_driver" = xlib; then
756 default_gl_osmesa=yes
760 AC_ARG_ENABLE([gl-osmesa],
761 [AS_HELP_STRING([--enable-gl-osmesa],
762 [enable OSMesa on libGL @<:@default=enabled for xlib driver@:>@])],
763 [gl_osmesa="$enableval"],
764 [gl_osmesa="$default_gl_osmesa"])
765 if test "x$gl_osmesa" = xyes; then
766 if test "$mesa_driver" = osmesa; then
767 AC_MSG_ERROR([libGL is not available for OSMesa driver])
769 DRIVER_DIRS="$DRIVER_DIRS osmesa"
773 dnl Configure the channel bits for OSMesa (libOSMesa, libOSMesa16, ...)
774 AC_ARG_WITH([osmesa-bits],
775 [AS_HELP_STRING([--with-osmesa-bits=BITS],
776 [OSMesa channel bits and library name: 8, 16, 32 @<:@default=8@:>@])],
777 [osmesa_bits="$withval"],
779 if test "$mesa_driver" != osmesa && test "x$osmesa_bits" != x8; then
780 AC_MSG_WARN([Ignoring OSMesa channel bits for non-OSMesa driver])
783 case "x$osmesa_bits" in
788 OSMESA_LIB="OSMesa$osmesa_bits"
789 DEFINES="$DEFINES -DCHAN_BITS=$osmesa_bits -DDEFAULT_SOFTWARE_DEPTH_BITS=31"
792 AC_MSG_ERROR([OSMesa bits '$osmesa_bits' is not a valid option])
795 AC_SUBST([OSMESA_LIB])
797 case "$mesa_driver" in
799 # only link libraries with osmesa if shared
800 if test "$enable_static" = no; then
801 OSMESA_LIB_DEPS="-lm -lpthread $SELINUX_LIBS"
808 # Link OSMesa to libGL otherwise
810 # only link libraries with osmesa if shared
811 if test "$enable_static" = no; then
812 OSMESA_MESA_DEPS='-l$(GL_LIB)'
818 if test "$enable_static" = no; then
819 OSMESA_LIB_DEPS="$OSMESA_LIB_DEPS $OS_LIBS"
821 AC_SUBST([OSMESA_LIB_DEPS])
822 AC_SUBST([OSMESA_MESA_DEPS])
825 dnl GLU configuration
828 [AS_HELP_STRING([--disable-glu],
829 [enable OpenGL Utility library @<:@default=enabled@:>@])],
830 [enable_glu="$enableval"],
832 if test "x$enable_glu" = xyes; then
833 SRC_DIRS="$SRC_DIRS glu"
835 case "$mesa_driver" in
837 # If GLU is available and we have libOSMesa (not 16 or 32),
838 # we can build the osdemos
839 if test "$with_demos" = yes && test "$osmesa_bits" = 8; then
840 PROGRAM_DIRS="$PROGRAM_DIRS osdemos"
843 # Link libGLU to libOSMesa instead of libGL
845 if test "$enable_static" = no; then
846 GLU_MESA_DEPS='-l$(OSMESA_LIB)'
852 # If static, empty GLU_LIB_DEPS and add libs for programs to link
853 if test "$enable_static" = no; then
855 GLU_MESA_DEPS='-l$(GL_LIB)'
859 APP_LIB_DEPS="$APP_LIB_DEPS -lstdc++"
864 if test "$enable_static" = no; then
865 GLU_LIB_DEPS="$GLU_LIB_DEPS $OS_CPLUSPLUS_LIBS"
867 AC_SUBST([GLU_LIB_DEPS])
868 AC_SUBST([GLU_MESA_DEPS])
871 dnl GLw configuration
874 [AS_HELP_STRING([--disable-glw],
875 [enable Xt/Motif widget library @<:@default=enabled@:>@])],
876 [enable_glw="$enableval"],
878 dnl Don't build GLw on osmesa
879 if test "x$enable_glw" = xyes && test "$mesa_driver" = osmesa; then
880 AC_MSG_WARN([Disabling GLw since the driver is OSMesa])
883 if test "x$enable_glw" = xyes; then
884 SRC_DIRS="$SRC_DIRS glw"
885 if test "$x11_pkgconfig" = yes; then
886 PKG_CHECK_MODULES([GLW],[x11 xt])
887 GLW_LIB_DEPS="$GLW_LIBS"
889 # should check these...
890 GLW_LIB_DEPS="$X_LIBS -lX11 -lXt"
893 # If static, empty GLW_LIB_DEPS and add libs for programs to link
894 if test "$enable_static" = no; then
895 GLW_MESA_DEPS='-l$(GL_LIB)'
896 GLW_LIB_DEPS="$GLW_LIB_DEPS $OS_LIBS"
898 APP_LIB_DEPS="$APP_LIB_DEPS $GLW_LIB_DEPS"
903 AC_SUBST([GLW_LIB_DEPS])
904 AC_SUBST([GLW_MESA_DEPS])
907 dnl GLUT configuration
909 if test -f "$srcdir/include/GL/glut.h"; then
914 AC_ARG_ENABLE([glut],
915 [AS_HELP_STRING([--disable-glut],
916 [enable GLUT library @<:@default=enabled if source available@:>@])],
917 [enable_glut="$enableval"],
918 [enable_glut="$default_glut"])
920 dnl Can't build glut if GLU not available
921 if test "x$enable_glu$enable_glut" = xnoyes; then
922 AC_MSG_WARN([Disabling glut since GLU is disabled])
925 dnl Don't build glut on osmesa
926 if test "x$enable_glut" = xyes && test "$mesa_driver" = osmesa; then
927 AC_MSG_WARN([Disabling glut since the driver is OSMesa])
931 if test "x$enable_glut" = xyes; then
932 SRC_DIRS="$SRC_DIRS glut/glx"
934 if test "x$GCC" = xyes; then
935 GLUT_CFLAGS="-fexceptions"
937 if test "$x11_pkgconfig" = yes; then
938 PKG_CHECK_MODULES([GLUT],[x11 xmu xi])
939 GLUT_LIB_DEPS="$GLUT_LIBS"
941 # should check these...
942 GLUT_LIB_DEPS="$X_LIBS -lX11 -lXmu -lXi"
944 GLUT_LIB_DEPS="$GLUT_LIB_DEPS -lm $OS_LIBS"
946 # If glut is available, we can build most programs
947 if test "$with_demos" = yes; then
948 PROGRAM_DIRS="$PROGRAM_DIRS demos redbook samples glsl"
951 # If static, empty GLUT_LIB_DEPS and add libs for programs to link
952 if test "$enable_static" = no; then
953 GLUT_MESA_DEPS='-l$(GLU_LIB) -l$(GL_LIB)'
955 APP_LIB_DEPS="$APP_LIB_DEPS $GLUT_LIB_DEPS"
960 AC_SUBST([GLUT_LIB_DEPS])
961 AC_SUBST([GLUT_MESA_DEPS])
962 AC_SUBST([GLUT_CFLAGS])
965 dnl Program library dependencies
966 dnl Only libm is added here if necessary as the libraries should
967 dnl be pulled in by the linker
969 if test "x$APP_LIB_DEPS" = x; then
972 APP_LIB_DEPS="-lX11 -lsocket -lnsl -lm"
979 AC_SUBST([APP_LIB_DEPS])
980 AC_SUBST([PROGRAM_DIRS])
983 dnl Restore LDFLAGS and CPPFLAGS
984 LDFLAGS="$_SAVE_LDFLAGS"
985 CPPFLAGS="$_SAVE_CPPFLAGS"
987 dnl Substitute the config
988 AC_CONFIG_FILES([configs/autoconf])
990 dnl Replace the configs/current symlink
991 AC_CONFIG_COMMANDS([configs],[
992 if test -f configs/current || test -L configs/current; then
993 rm -f configs/current
995 ln -s autoconf configs/current
1001 dnl Output some configuration info for the user
1004 echo " prefix: $prefix"
1005 echo " exec_prefix: $exec_prefix"
1006 echo " libdir: $libdir"
1007 echo " includedir: $includedir"
1011 echo " Driver: $mesa_driver"
1012 if echo "$DRIVER_DIRS" | grep 'osmesa' >/dev/null 2>&1; then
1013 echo " OSMesa: lib$OSMESA_LIB"
1017 if test "$mesa_driver" = dri; then
1018 # cleanup the drivers var
1019 dri_dirs=`echo $DRI_DIRS | $SED 's/^ *//;s/ */ /;s/ *$//'`
1020 echo " DRI drivers: $dri_dirs"
1021 echo " DRI driver dir: $DRI_DRIVER_INSTALL_DIR"
1022 echo " TTM API support: $ttmapi"
1027 echo " Shared libs: $enable_shared"
1028 echo " Static libs: $enable_static"
1029 echo " GLU: $enable_glu"
1030 echo " GLw: $enable_glw"
1031 echo " glut: $enable_glut"
1034 # cleanup the programs var for display
1035 program_dirs=`echo $PROGRAM_DIRS | $SED 's/^ *//;s/ */ /;s/ *$//'`
1036 if test "x$program_dirs" = x; then
1039 echo " Demos: $program_dirs"
1042 dnl Compiler options
1043 # cleanup the CFLAGS/CXXFLAGS/DEFINES vars
1044 cflags=`echo $CFLAGS $OPT_FLAGS $PIC_FLAGS $ARCH_FLAGS | \
1045 $SED 's/^ *//;s/ */ /;s/ *$//'`
1046 cxxflags=`echo $CXXFLAGS $OPT_FLAGS $PIC_FLAGS $ARCH_FLAGS | \
1047 $SED 's/^ *//;s/ */ /;s/ *$//'`
1048 defines=`echo $DEFINES $ASM_FLAGS | $SED 's/^ *//;s/ */ /;s/ *$//'`
1050 echo " CFLAGS: $cflags"
1051 echo " CXXFLAGS: $cxxflags"
1052 echo " Macros: $defines"
1055 echo " Run '${MAKE-make}' to build Mesa"