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 MKDEP_OPTIONS=-fdepend
33 dnl Ask gcc where it's keeping its secret headers
34 if test "x$GCC" = xyes; then
35 GCC_INCLUDES=`$CC -print-file-name=include`
36 if test "x$GCC_INCLUDES" != x; then
37 MKDEP_OPTIONS="$MKDEP_OPTIONS -I$GCC_INCLUDES"
40 AC_SUBST([MKDEP_OPTIONS])
42 dnl Make sure the pkg-config macros are defined
43 m4_ifdef([PKG_PROG_PKG_CONFIG],[],[
44 m4_errprint([Error: Could not locate the pkg-config autoconf macros.
45 These are usually located in /usr/share/aclocal/pkg.m4. If your
46 macros are in a different location, try setting the environment
47 variable ACLOCAL="aclocal -I/other/macro/dir" before running
54 dnl LIB_DIR - library basename
55 LIB_DIR=`echo $libdir | $SED 's%.*/%%'`
58 dnl Cache LDFLAGS so we can add EXTRA_LIB_PATH and restore it later
59 _SAVE_LDFLAGS="$LDFLAGS"
60 AC_ARG_VAR([EXTRA_LIB_PATH],[Extra -L paths for the linker])
61 AC_SUBST([EXTRA_LIB_PATH])
63 dnl Cache CPPFLAGS so we can add *_INCLUDES and restore it later
64 _SAVE_CPPFLAGS="$CPPFLAGS"
65 AC_ARG_VAR([X11_INCLUDES],[Extra -I paths for X11 headers])
66 AC_SUBST([X11_INCLUDES])
73 if test "x$GCC" = xyes; then
74 DEFINES="$DEFINES -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_BSD_SOURCE"
76 DEFINES="$DEFINES -D_SVID_SOURCE -D_GNU_SOURCE -DPTHREADS -DHAVE_POSIX_MEMALIGN"
80 dnl Add flags for gcc and g++
81 if test "x$GCC" = xyes; then
82 CFLAGS="$CFLAGS -Wall -Wmissing-prototypes -std=c99 -ffast-math"
84 # Work around aliasing bugs - developers should comment this out
85 CFLAGS="$CFLAGS -fno-strict-aliasing"
87 if test "x$GXX" = xyes; then
88 CXXFLAGS="$CXXFLAGS -Wall"
90 # Work around aliasing bugs - developers should comment this out
91 CXXFLAGS="$CXXFLAGS -fno-strict-aliasing"
94 dnl These should be unnecessary, but let the user set them if they want
95 AC_ARG_VAR([OPT_FLAGS], [Additional optimization flags for the compiler.
96 Default is to use CFLAGS.])
97 AC_ARG_VAR([ARCH_FLAGS], [Additional architecture specific flags for the
98 compiler. Default is to use CFLAGS.])
100 AC_SUBST([ARCH_FLAGS])
103 dnl Hacks to enable 32 or 64 bit build
105 AC_ARG_ENABLE([32-bit],
106 [AS_HELP_STRING([--enable-32-bit],
107 [build 32-bit libraries @<:@default=auto@:>@])],
108 [enable_32bit="$enableval"],
111 if test "x$enable_32bit" = xyes; then
112 if test "x$GCC" = xyes; then
113 CFLAGS="$CFLAGS -m32"
115 if test "x$GXX" = xyes; then
116 CXXFLAGS="$CXXFLAGS -m32"
119 AC_ARG_ENABLE([64-bit],
120 [AS_HELP_STRING([--enable-64-bit],
121 [build 64-bit libraries @<:@default=auto@:>@])],
122 [enable_64bit="$enableval"],
125 if test "x$enable_64bit" = xyes; then
126 if test "x$GCC" = xyes; then
127 CFLAGS="$CFLAGS -m64"
129 if test "x$GXX" = xyes; then
130 CXXFLAGS="$CXXFLAGS -m64"
135 dnl shared/static libraries, mimic libtool options
137 AC_ARG_ENABLE([static],
138 [AS_HELP_STRING([--enable-static],
139 [build static libraries @<:@default=disabled@:>@])],
140 [enable_static="$enableval"],
143 case "x$enable_static" in
145 x ) enable_static=no ;;
147 AC_MSG_ERROR([Static library option '$enable_static' is not a valid])
150 AC_ARG_ENABLE([shared],
151 [AS_HELP_STRING([--disable-shared],
152 [build shared libraries @<:@default=enabled@:>@])],
153 [enable_shared="$enableval"],
156 case "x$enable_shared" in
158 x ) enable_shared=yes ;;
160 AC_MSG_ERROR([Shared library option '$enable_shared' is not a valid])
164 dnl Can't have static and shared libraries, default to static if user
165 dnl explicitly requested. If both disabled, set to static since shared
166 dnl was explicitly requirested.
167 case "x$enable_static$enable_shared" in
169 AC_MSG_WARN([Can't build static and shared libraries, disabling shared])
173 AC_MSG_WARN([Can't disable both static and shared libraries, enabling static])
181 AC_ARG_VAR([MKLIB_OPTIONS],[Options for the Mesa library script, mklib])
182 if test "$enable_static" = yes; then
183 MKLIB_OPTIONS="$MKLIB_OPTIONS -static"
185 AC_SUBST([MKLIB_OPTIONS])
188 dnl other compiler options
190 AC_ARG_ENABLE([debug],
191 [AS_HELP_STRING([--enable-debug],
192 [use debug compiler flags and macros @<:@default=disabled@:>@])],
193 [enable_debug="$enableval"],
196 if test "x$enable_debug" = xyes; then
197 DEFINES="$DEFINES -DDEBUG"
198 if test "x$GCC" = xyes; then
201 if test "x$GXX" = xyes; then
202 CXXFLAGS="$CXXFLAGS -g"
209 if test "$enable_static" = yes; then
210 GL_LIB_NAME='lib$(GL_LIB).a'
211 GLU_LIB_NAME='lib$(GLU_LIB).a'
212 GLUT_LIB_NAME='lib$(GLUT_LIB).a'
213 GLW_LIB_NAME='lib$(GLW_LIB).a'
214 OSMESA_LIB_NAME='lib$(OSMESA_LIB).a'
216 GL_LIB_NAME='lib$(GL_LIB).so'
217 GLU_LIB_NAME='lib$(GLU_LIB).so'
218 GLUT_LIB_NAME='lib$(GLUT_LIB).so'
219 GLW_LIB_NAME='lib$(GLW_LIB).so'
220 OSMESA_LIB_NAME='lib$(OSMESA_LIB).so'
222 AC_SUBST([GL_LIB_NAME])
223 AC_SUBST([GLU_LIB_NAME])
224 AC_SUBST([GLUT_LIB_NAME])
225 AC_SUBST([GLW_LIB_NAME])
226 AC_SUBST([OSMESA_LIB_NAME])
229 dnl Arch/platform-specific settings
232 [AS_HELP_STRING([--disable-asm],
233 [disable assembly usage @<:@default=enabled on supported plaforms@:>@])],
234 [enable_asm="$enableval"],
241 AC_MSG_CHECKING([whether to enable assembly])
242 test "x$enable_asm" = xno && AC_MSG_RESULT([no])
243 # disable if cross compiling on x86/x86_64 since we must run gen_matypes
244 if test "x$enable_asm" = xyes && test "x$cross_compiling" = xyes; then
248 AC_MSG_RESULT([no, cross compiling])
252 # check for supported arches
253 if test "x$enable_asm" = xyes; then
257 linux* | freebsd* | dragonfly*)
258 test "x$enable_64bit" = xyes && asm_arch=x86_64 || asm_arch=x86
264 linux* | freebsd* | dragonfly*)
265 test "x$enable_32bit" = xyes && asm_arch=x86 || asm_arch=x86_64
280 ASM_FLAGS="-DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM"
281 ASM_SOURCES='$(X86_SOURCES)'
283 AC_MSG_RESULT([yes, x86])
286 ASM_FLAGS="-DUSE_X86_64_ASM"
287 ASM_SOURCES='$(X86-64_SOURCES)'
288 ASM_API='$(X86-64_API)'
289 AC_MSG_RESULT([yes, x86_64])
292 ASM_FLAGS="-DUSE_PPC_ASM -DUSE_VMX_ASM"
293 ASM_SOURCES='$(PPC_SOURCES)'
294 AC_MSG_RESULT([yes, ppc])
297 AC_MSG_RESULT([no, platform not supported])
301 AC_SUBST([ASM_FLAGS])
302 AC_SUBST([ASM_SOURCES])
308 dnl Check to see if dlopen is in default libraries (like Solaris, which
309 dnl has it in libc), or if libdl is needed to get it.
310 AC_CHECK_FUNC([dlopen], [],
311 [AC_CHECK_LIB([dl], [dlopen], [DLOPEN_LIBS="-ldl"])])
313 dnl SELinux awareness.
314 AC_ARG_ENABLE([selinux],
315 [AS_HELP_STRING([--enable-selinux],
316 [Build SELinux-aware Mesa @<:@default=disabled@:>@])],
317 [MESA_SELINUX="$enableval"],
319 if test "x$enable_selinux" = "xyes"; then
320 AC_CHECK_HEADER([selinux/selinux.h],[],
321 [AC_MSG_ERROR([SELinux headers not found])])
322 AC_CHECK_LIB([selinux],[is_selinux_enabled],[],
323 [AC_MSG_ERROR([SELinux library not found])])
324 SELINUX_LIBS="-lselinux"
325 DEFINES="$DEFINES -DMESA_SELINUX"
330 dnl Driver configuration. Options are xlib, dri and osmesa right now.
331 dnl More later: directfb, fbdev, ...
333 default_driver="xlib"
338 i*86|x86_64|powerpc*) default_driver="dri";;
341 freebsd* | dragonfly*)
343 i*86|x86_64) default_driver="dri";;
348 AC_ARG_WITH([driver],
349 [AS_HELP_STRING([--with-driver=DRIVER],
350 [driver for Mesa: xlib,dri,osmesa @<:@default=dri when available, or xlib@:>@])],
351 [mesa_driver="$withval"],
352 [mesa_driver="$default_driver"])
353 dnl Check for valid option
354 case "x$mesa_driver" in
358 AC_MSG_ERROR([Driver '$mesa_driver' is not a valid option])
363 dnl Driver specific build directories
368 case "$mesa_driver" in
373 SRC_DIRS="glx/x11 $SRC_DIRS"
383 AC_SUBST([DRIVER_DIRS])
384 AC_SUBST([WINDOW_SYSTEM])
387 dnl User supplied program configuration
389 if test -d "$srcdir/progs/demos"; then
395 [AS_HELP_STRING([--with-demos@<:@=DIRS...@:>@],
396 [optional comma delimited demo directories to build
397 @<:@default=auto if source available@:>@])],
398 [with_demos="$withval"],
399 [with_demos="$default_demos"])
400 if test "x$with_demos" = x; then
404 dnl If $with_demos is yes, directories will be added as libs available
406 case "$with_demos" in
409 # If the driver isn't osmesa, we have libGL and can build xdemos
410 if test "$mesa_driver" != osmesa; then
411 PROGRAM_DIRS="xdemos"
415 # verify the requested demos directories exist
416 demos=`IFS=,; echo $with_demos`
417 for demo in $demos; do
418 test -d "$srcdir/progs/$demo" || \
419 AC_MSG_ERROR([Program directory '$demo' doesn't exist])
421 PROGRAM_DIRS="$demos"
426 dnl Find out if X is available. The variable have_x is set if libX11 is
427 dnl to mimic AC_PATH_XTRA.
429 if test -n "$PKG_CONFIG"; then
430 AC_MSG_CHECKING([pkg-config files for X11 are available])
431 PKG_CHECK_EXISTS([x11],[
437 AC_MSG_RESULT([$x11_pkgconfig])
441 dnl Use the autoconf macro if no pkg-config files
442 if test "$x11_pkgconfig" = no; then
446 dnl We need X for xlib and dri, so bomb now if it's not found
447 case "$mesa_driver" in
449 if test "$no_x" = yes; then
450 AC_MSG_ERROR([X11 development libraries needed for $mesa_driver driver])
455 dnl XCB - this is only used for GLX right now
457 [AS_HELP_STRING([--enable-xcb],
458 [use XCB for GLX @<:@default=disabled@:>@])],
459 [enable_xcb="$enableval"],
461 if test "x$enable_xcb" = xyes; then
462 DEFINES="$DEFINES -DUSE_XCB"
468 dnl libGL configuration per driver
470 case "$mesa_driver" in
472 if test "$x11_pkgconfig" = yes; then
473 PKG_CHECK_MODULES([XLIBGL], [x11 xext])
474 X11_INCLUDES="$X11_INCLUDES $XLIBGL_CFLAGS"
475 GL_LIB_DEPS="$XLIBGL_LIBS"
477 # should check these...
478 X11_INCLUDES="$X11_INCLUDES $X_CFLAGS"
479 GL_LIB_DEPS="$X_LIBS -lX11 -lXext"
481 GL_LIB_DEPS="$GL_LIB_DEPS $SELINUX_LIBS -lm -lpthread"
483 # if static, move the external libraries to the programs
484 # and empty the libraries for libGL
485 if test "$enable_static" = yes; then
486 APP_LIB_DEPS="$APP_LIB_DEPS $GL_LIB_DEPS"
491 # DRI must be shared, I think
492 if test "$enable_static" = yes; then
493 AC_MSG_ERROR([Can't use static libraries for DRI drivers])
497 PKG_CHECK_MODULES([LIBDRM], [libdrm >= $LIBDRM_REQUIRED])
498 PKG_CHECK_MODULES([DRI2PROTO], [dri2proto >= $DRI2PROTO_REQUIRED])
500 # find the DRI deps for libGL
501 if test "$x11_pkgconfig" = yes; then
502 # add xcb modules if necessary
503 dri_modules="x11 xext xxf86vm xdamage xfixes"
504 if test "$enable_xcb" = yes; then
505 dri_modules="$dri_modules x11-xcb xcb-glx"
508 PKG_CHECK_MODULES([DRIGL], [$dri_modules])
509 X11_INCLUDES="$X11_INCLUDES $DRIGL_CFLAGS"
510 GL_LIB_DEPS="$DRIGL_LIBS"
512 # should check these...
513 X11_INCLUDES="$X11_INCLUDES $X_CFLAGS"
514 GL_LIB_DEPS="$X_LIBS -lX11 -lXext -lXxf86vm -lXdamage -lXfixes"
516 # XCB can only be used from pkg-config
517 if test "$enable_xcb" = yes; then
518 PKG_CHECK_MODULES([XCB],[x11-xcb xcb-glx])
519 X11_INCLUDES="$X11_INCLUDES $XCB_CFLAGS"
520 GL_LIB_DEPS="$GL_LIB_DEPS $XCB_LIBS"
524 # need DRM libs, -lpthread, etc.
525 GL_LIB_DEPS="$GL_LIB_DEPS $LIBDRM_LIBS -lm -lpthread $DLOPEN_LIBS"
528 # No libGL for osmesa
532 AC_SUBST([GL_LIB_DEPS])
537 if test "$mesa_driver" = xlib; then
538 DEFINES="$DEFINES -DUSE_XSHM"
544 AC_ARG_ENABLE([glx-tls],
545 [AS_HELP_STRING([--enable-glx-tls],
546 [enable TLS support in GLX @<:@default=disabled@:>@])],
547 [GLX_USE_TLS="$enableval"],
549 dnl Directory for DRI drivers
550 AC_ARG_WITH([dri-driverdir],
551 [AS_HELP_STRING([--with-dri-driverdir=DIR],
552 [directory for the DRI drivers @<:@${libdir}/dri@:>@])],
553 [DRI_DRIVER_INSTALL_DIR="$withval"],
554 [DRI_DRIVER_INSTALL_DIR='${libdir}/dri'])
555 AC_SUBST([DRI_DRIVER_INSTALL_DIR])
556 dnl Direct rendering or just indirect rendering
557 AC_ARG_ENABLE([driglx-direct],
558 [AS_HELP_STRING([--disable-driglx-direct],
559 [enable direct rendering in GLX for DRI @<:@default=enabled@:>@])],
560 [driglx_direct="$enableval"],
561 [driglx_direct="yes"])
563 AC_ARG_ENABLE([ttm-api],
564 [AS_HELP_STRING([--enable-ttm-api],
565 [enable TTM API users @<:@default=disabled@:>@])],
566 [ttmapi="$enableval"],
569 if test "x$ttmapi" = "xyes"; then
571 CFLAGS=$LIBDRM_CFLAGS
572 AC_CHECK_HEADERS([xf86mm.h],[],[AC_MSG_ERROR([xf86mm.h required for TTM.])],[#include "stdint.h"\n#include "drm.h"])
576 dnl Which drivers to build - default is chosen by platform
577 AC_ARG_WITH([dri-drivers],
578 [AS_HELP_STRING([--with-dri-drivers@<:@=DIRS...@:>@],
579 [comma delimited DRI drivers, e.g. "i965,radeon,nouveau" @<:@default=auto@:>@])],
580 [with_dri_drivers="$withval"],
581 [with_dri_drivers=yes])
582 if test "x$with_dri_drivers" = x; then
586 dnl If $with_dri_drivers is yes, directories will be added through
589 case "$with_dri_drivers" in
592 # verify the requested driver directories exist
593 dri_drivers=`IFS=,; echo $with_dri_drivers`
594 for driver in $dri_drivers; do
595 test -d "$srcdir/src/mesa/drivers/dri/$driver" || \
596 AC_MSG_ERROR([DRI driver directory '$driver' doesn't exist])
598 DRI_DIRS="$dri_drivers"
602 dnl Just default to no EGL for now
604 AC_SUBST([USING_EGL])
606 dnl Set DRI_DIRS, DEFINES and LIB_DEPS
607 if test "$mesa_driver" = dri; then
609 if test "x$GLX_USE_TLS" = xyes; then
610 DEFINES="$DEFINES -DGLX_USE_TLS -DPTHREADS"
613 if test "x$ttmapi" = xyes; then
614 DEFINES="$DEFINES -DTTM_API"
617 if test "x$USING_EGL" = x1; then
621 # Platform specific settings and drivers to build
624 DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
625 DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING -DHAVE_ALIAS"
626 if test "x$driglx_direct" = xyes; then
627 DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
632 # ffb, gamma, and sis are missing because they have not be
633 # converted to use the new interface. i810 are missing
634 # because there is no x86-64 system where they could *ever*
636 if test "x$DRI_DIRS" = x; then
637 DRI_DIRS="i915 i965 mach64 mga r128 r200 r300 radeon \
638 savage tdfx unichrome swrast"
642 # Build only the drivers for cards that exist on PowerPC.
643 # At some point MGA will be added, but not yet.
644 if test "x$DRI_DIRS" = x; then
645 DRI_DIRS="mach64 r128 r200 r300 radeon tdfx swrast"
650 freebsd* | dragonfly*)
651 DEFINES="$DEFINES -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1"
652 DEFINES="$DEFINES -DIN_DRI_DRIVER -DHAVE_ALIAS"
653 DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING"
654 if test "x$driglx_direct" = xyes; then
655 DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
657 if test "x$GXX" = xyes; then
658 CXXFLAGS="$CXXFLAGS -ansi -pedantic"
661 # ffb and gamma are missing because they have not been converted
662 # to use the new interface.
663 if test "x$DRI_DIRS" = x; then
664 DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 radeon tdfx \
665 unichrome savage sis swrast"
671 if test "x$DRI_DIRS" = x; then
672 DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 radeon s3v \
673 savage sis tdfx trident unichrome ffb swrast"
676 DRI_DIRS=`echo "$DRI_DIRS" | $SED 's/ */ /g'`
682 [AS_HELP_STRING([--with-expat=DIR],
683 [expat install directory])],[
684 EXPAT_INCLUDES="-I$withval/include"
685 CPPFLAGS="$CPPFLAGS $EXPAT_INCLUDES"
686 LDFLAGS="$LDFLAGS -L$withval/$LIB_DIR"
687 EXPAT_LIB="-L$withval/$LIB_DIR -lexpat"
689 AC_CHECK_HEADER([expat.h],[],[AC_MSG_ERROR([Expat required for DRI.])])
690 AC_CHECK_LIB([expat],[XML_ParserCreate],[],
691 [AC_MSG_ERROR([Expat required for DRI.])])
693 # put all the necessary libs together
694 DRI_LIB_DEPS="$SELINUX_LIBS $LIBDRM_LIBS $EXPAT_LIB -lm -lpthread $DLOPEN_LIBS"
697 AC_SUBST([EXPAT_INCLUDES])
698 AC_SUBST([DRI_LIB_DEPS])
701 dnl OSMesa configuration
703 if test "$mesa_driver" = xlib; then
704 default_gl_osmesa=yes
708 AC_ARG_ENABLE([gl-osmesa],
709 [AS_HELP_STRING([--enable-gl-osmesa],
710 [enable OSMesa on libGL @<:@default=enabled for xlib driver@:>@])],
711 [gl_osmesa="$enableval"],
712 [gl_osmesa="$default_gl_osmesa"])
713 if test "x$gl_osmesa" = xyes; then
714 if test "$mesa_driver" = osmesa; then
715 AC_MSG_ERROR([libGL is not available for OSMesa driver])
717 DRIVER_DIRS="$DRIVER_DIRS osmesa"
721 dnl Configure the channel bits for OSMesa (libOSMesa, libOSMesa16, ...)
722 AC_ARG_WITH([osmesa-bits],
723 [AS_HELP_STRING([--with-osmesa-bits=BITS],
724 [OSMesa channel bits and library name: 8, 16, 32 @<:@default=8@:>@])],
725 [osmesa_bits="$withval"],
727 if test "$mesa_driver" != osmesa && test "x$osmesa_bits" != x8; then
728 AC_MSG_WARN([Ignoring OSMesa channel bits for non-OSMesa driver])
731 case "x$osmesa_bits" in
736 OSMESA_LIB="OSMesa$osmesa_bits"
737 DEFINES="$DEFINES -DCHAN_BITS=$osmesa_bits -DDEFAULT_SOFTWARE_DEPTH_BITS=31"
740 AC_MSG_ERROR([OSMesa bits '$osmesa_bits' is not a valid option])
743 AC_SUBST([OSMESA_LIB])
745 case "$mesa_driver" in
747 # only link librararies with osmesa if shared
748 if test "$enable_static" = no; then
749 OSMESA_LIB_DEPS="-lm -lpthread $SELINUX_LIBS"
756 # Link OSMesa to libGL otherwise
758 # only link librararies with osmesa if shared
759 if test "$enable_static" = no; then
760 OSMESA_MESA_DEPS='-l$(GL_LIB)'
766 AC_SUBST([OSMESA_LIB_DEPS])
767 AC_SUBST([OSMESA_MESA_DEPS])
770 dnl GLU configuration
773 [AS_HELP_STRING([--disable-glu],
774 [enable OpenGL Utility library @<:@default=enabled@:>@])],
775 [enable_glu="$enableval"],
777 if test "x$enable_glu" = xyes; then
778 SRC_DIRS="$SRC_DIRS glu"
780 case "$mesa_driver" in
782 # If GLU is available and we have libOSMesa (not 16 or 32),
783 # we can build the osdemos
784 if test "$with_demos" = yes && test "$osmesa_bits" = 8; then
785 PROGRAM_DIRS="$PROGRAM_DIRS osdemos"
788 # Link libGLU to libOSMesa instead of libGL
790 if test "$enable_static" = no; then
791 GLU_MESA_DEPS='-l$(OSMESA_LIB)'
797 # If static, empty GLU_LIB_DEPS and add libs for programs to link
798 if test "$enable_static" = no; then
800 GLU_MESA_DEPS='-l$(GL_LIB)'
804 APP_LIB_DEPS="$APP_LIB_DEPS -lstdc++"
809 AC_SUBST([GLU_LIB_DEPS])
810 AC_SUBST([GLU_MESA_DEPS])
813 dnl GLw configuration
816 [AS_HELP_STRING([--disable-glw],
817 [enable Xt/Motif widget library @<:@default=enabled@:>@])],
818 [enable_glw="$enableval"],
820 dnl Don't build GLw on osmesa
821 if test "x$enable_glw" = xyes && test "$mesa_driver" = osmesa; then
822 AC_MSG_WARN([Disabling GLw since the driver is OSMesa])
825 if test "x$enable_glw" = xyes; then
826 SRC_DIRS="$SRC_DIRS glw"
827 if test "$x11_pkgconfig" = yes; then
828 PKG_CHECK_MODULES([GLW],[x11 xt])
829 GLW_LIB_DEPS="$GLW_LIBS"
831 # should check these...
832 GLW_LIB_DEPS="$X_LIBS -lX11 -lXt"
835 # If static, empty GLW_LIB_DEPS and add libs for programs to link
836 if test "$enable_static" = no; then
837 GLW_MESA_DEPS='-l$(GL_LIB)'
839 APP_LIB_DEPS="$APP_LIB_DEPS $GLW_LIB_DEPS"
844 AC_SUBST([GLW_LIB_DEPS])
845 AC_SUBST([GLW_MESA_DEPS])
848 dnl GLUT configuration
850 if test -f "$srcdir/include/GL/glut.h"; then
855 AC_ARG_ENABLE([glut],
856 [AS_HELP_STRING([--disable-glut],
857 [enable GLUT library @<:@default=enabled if source available@:>@])],
858 [enable_glut="$enableval"],
859 [enable_glut="$default_glut"])
861 dnl Can't build glut if GLU not available
862 if test "x$enable_glu$enable_glut" = xnoyes; then
863 AC_MSG_WARN([Disabling glut since GLU is disabled])
866 dnl Don't build glut on osmesa
867 if test "x$enable_glut" = xyes && test "$mesa_driver" = osmesa; then
868 AC_MSG_WARN([Disabling glut since the driver is OSMesa])
872 if test "x$enable_glut" = xyes; then
873 SRC_DIRS="$SRC_DIRS glut/glx"
875 if test "x$GCC" = xyes; then
876 GLUT_CFLAGS="-fexceptions"
878 if test "$x11_pkgconfig" = yes; then
879 PKG_CHECK_MODULES([GLUT],[x11 xmu xi])
880 GLUT_LIB_DEPS="$GLUT_LIBS"
882 # should check these...
883 GLUT_LIB_DEPS="$X_LIBS -lX11 -lXmu -lXi"
885 GLUT_LIB_DEPS="$GLUT_LIB_DEPS -lm"
887 # If glut is available, we can build most programs
888 if test "$with_demos" = yes; then
889 PROGRAM_DIRS="$PROGRAM_DIRS demos redbook samples glsl"
892 # If static, empty GLUT_LIB_DEPS and add libs for programs to link
893 if test "$enable_static" = no; then
894 GLUT_MESA_DEPS='-l$(GLU_LIB) -l$(GL_LIB)'
896 APP_LIB_DEPS="$APP_LIB_DEPS $GLUT_LIB_DEPS"
901 AC_SUBST([GLUT_LIB_DEPS])
902 AC_SUBST([GLUT_MESA_DEPS])
903 AC_SUBST([GLUT_CFLAGS])
906 dnl Program library dependencies
907 dnl Only libm is added here if necessary as the libraries should
908 dnl be pulled in by the linker
910 if test "x$APP_LIB_DEPS" = x; then
913 AC_SUBST([APP_LIB_DEPS])
914 AC_SUBST([PROGRAM_DIRS])
917 dnl Restore LDFLAGS and CPPFLAGS
918 LDFLAGS="$_SAVE_LDFLAGS"
919 CPPFLAGS="$_SAVE_CPPFLAGS"
921 dnl Substitute the config
922 AC_CONFIG_FILES([configs/autoconf])
924 dnl Replace the configs/current symlink
925 AC_CONFIG_COMMANDS([configs],[
926 if test -f configs/current || test -L configs/current; then
927 rm -f configs/current
929 ln -s autoconf configs/current
935 dnl Output some configuration info for the user
938 echo " prefix: $prefix"
939 echo " exec_prefix: $exec_prefix"
940 echo " libdir: $libdir"
944 echo " Driver: $mesa_driver"
945 if echo "$DRIVER_DIRS" | grep 'osmesa' >/dev/null 2>&1; then
946 echo " OSMesa: lib$OSMESA_LIB"
950 if test "$mesa_driver" = dri; then
951 # cleanup the drivers var
952 dri_dirs=`echo $DRI_DIRS | $SED 's/^ *//;s/ */ /;s/ *$//'`
953 echo " DRI drivers: $dri_dirs"
954 echo " DRI driver dir: $DRI_DRIVER_INSTALL_DIR"
955 echo " TTM API support: $ttmapi"
960 echo " Shared libs: $enable_shared"
961 echo " Static libs: $enable_static"
962 echo " GLU: $enable_glu"
963 echo " GLw: $enable_glw"
964 echo " glut: $enable_glut"
967 # cleanup the programs var for display
968 program_dirs=`echo $PROGRAM_DIRS | $SED 's/^ *//;s/ */ /;s/ *$//'`
969 if test "x$program_dirs" = x; then
972 echo " Demos: $program_dirs"
976 # cleanup the CFLAGS/CXXFLAGS/DEFINES vars
977 cflags=`echo $CFLAGS $OPT_FLAGS $PIC_FLAGS $ARCH_FLAGS | \
978 $SED 's/^ *//;s/ */ /;s/ *$//'`
979 cxxflags=`echo $CXXFLAGS $OPT_FLAGS $PIC_FLAGS $ARCH_FLAGS | \
980 $SED 's/^ *//;s/ */ /;s/ *$//'`
981 defines=`echo $DEFINES $ASM_FLAGS | $SED 's/^ *//;s/ */ /;s/ *$//'`
983 echo " CFLAGS: $cflags"
984 echo " CXXFLAGS: $cxxflags"
985 echo " Macros: $defines"
988 echo " Run '${MAKE-make}' to build Mesa"