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"
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 See if posix_memalign is available
329 AC_CHECK_FUNC([posix_memalign], [DEFINES="$DEFINES -DHAVE_POSIX_MEMALIGN"])
331 dnl SELinux awareness.
332 AC_ARG_ENABLE([selinux],
333 [AS_HELP_STRING([--enable-selinux],
334 [Build SELinux-aware Mesa @<:@default=disabled@:>@])],
335 [MESA_SELINUX="$enableval"],
337 if test "x$enable_selinux" = "xyes"; then
338 AC_CHECK_HEADER([selinux/selinux.h],[],
339 [AC_MSG_ERROR([SELinux headers not found])])
340 AC_CHECK_LIB([selinux],[is_selinux_enabled],[],
341 [AC_MSG_ERROR([SELinux library not found])])
342 SELINUX_LIBS="-lselinux"
343 DEFINES="$DEFINES -DMESA_SELINUX"
346 dnl OS-specific libraries
351 if test "x$GXX" != xyes; then
352 OS_CPLUSPLUS_LIBS="-lCrun $OS_LIBS"
358 dnl Driver configuration. Options are xlib, dri and osmesa right now.
359 dnl More later: directfb, fbdev, ...
361 default_driver="xlib"
366 i*86|x86_64|powerpc*) default_driver="dri";;
369 freebsd* | dragonfly*)
371 i*86|x86_64) default_driver="dri";;
376 AC_ARG_WITH([driver],
377 [AS_HELP_STRING([--with-driver=DRIVER],
378 [driver for Mesa: xlib,dri,osmesa @<:@default=dri when available, or xlib@:>@])],
379 [mesa_driver="$withval"],
380 [mesa_driver="$default_driver"])
381 dnl Check for valid option
382 case "x$mesa_driver" in
386 AC_MSG_ERROR([Driver '$mesa_driver' is not a valid option])
391 dnl Driver specific build directories
396 case "$mesa_driver" in
401 SRC_DIRS="glx/x11 $SRC_DIRS"
411 AC_SUBST([DRIVER_DIRS])
412 AC_SUBST([WINDOW_SYSTEM])
415 dnl User supplied program configuration
417 if test -d "$srcdir/progs/demos"; then
423 [AS_HELP_STRING([--with-demos@<:@=DIRS...@:>@],
424 [optional comma delimited demo directories to build
425 @<:@default=auto if source available@:>@])],
426 [with_demos="$withval"],
427 [with_demos="$default_demos"])
428 if test "x$with_demos" = x; then
432 dnl If $with_demos is yes, directories will be added as libs available
434 case "$with_demos" in
437 # If the driver isn't osmesa, we have libGL and can build xdemos
438 if test "$mesa_driver" != osmesa; then
439 PROGRAM_DIRS="xdemos"
443 # verify the requested demos directories exist
444 demos=`IFS=,; echo $with_demos`
445 for demo in $demos; do
446 test -d "$srcdir/progs/$demo" || \
447 AC_MSG_ERROR([Program directory '$demo' doesn't exist])
449 PROGRAM_DIRS="$demos"
454 dnl Find out if X is available. The variable have_x is set if libX11 is
455 dnl to mimic AC_PATH_XTRA.
457 if test -n "$PKG_CONFIG"; then
458 AC_MSG_CHECKING([pkg-config files for X11 are available])
459 PKG_CHECK_EXISTS([x11],[
465 AC_MSG_RESULT([$x11_pkgconfig])
469 dnl Use the autoconf macro if no pkg-config files
470 if test "$x11_pkgconfig" = no; then
474 dnl We need X for xlib and dri, so bomb now if it's not found
475 case "$mesa_driver" in
477 if test "$no_x" = yes; then
478 AC_MSG_ERROR([X11 development libraries needed for $mesa_driver driver])
483 dnl XCB - this is only used for GLX right now
485 [AS_HELP_STRING([--enable-xcb],
486 [use XCB for GLX @<:@default=disabled@:>@])],
487 [enable_xcb="$enableval"],
489 if test "x$enable_xcb" = xyes; then
490 DEFINES="$DEFINES -DUSE_XCB"
496 dnl libGL configuration per driver
498 case "$mesa_driver" in
500 if test "$x11_pkgconfig" = yes; then
501 PKG_CHECK_MODULES([XLIBGL], [x11 xext])
502 X11_INCLUDES="$X11_INCLUDES $XLIBGL_CFLAGS"
503 GL_LIB_DEPS="$XLIBGL_LIBS"
505 # should check these...
506 X11_INCLUDES="$X11_INCLUDES $X_CFLAGS"
507 GL_LIB_DEPS="$X_LIBS -lX11 -lXext"
509 GL_LIB_DEPS="$GL_LIB_DEPS $SELINUX_LIBS -lm -lpthread $OS_LIBS"
511 # if static, move the external libraries to the programs
512 # and empty the libraries for libGL
513 if test "$enable_static" = yes; then
514 APP_LIB_DEPS="$APP_LIB_DEPS $GL_LIB_DEPS"
519 # DRI must be shared, I think
520 if test "$enable_static" = yes; then
521 AC_MSG_ERROR([Can't use static libraries for DRI drivers])
525 PKG_CHECK_MODULES([LIBDRM], [libdrm >= $LIBDRM_REQUIRED])
526 PKG_CHECK_MODULES([DRI2PROTO], [dri2proto >= $DRI2PROTO_REQUIRED])
528 # find the DRI deps for libGL
529 if test "$x11_pkgconfig" = yes; then
530 # add xcb modules if necessary
531 dri_modules="x11 xext xxf86vm xdamage xfixes"
532 if test "$enable_xcb" = yes; then
533 dri_modules="$dri_modules x11-xcb xcb-glx"
536 PKG_CHECK_MODULES([DRIGL], [$dri_modules])
537 X11_INCLUDES="$X11_INCLUDES $DRIGL_CFLAGS"
538 GL_LIB_DEPS="$DRIGL_LIBS"
540 # should check these...
541 X11_INCLUDES="$X11_INCLUDES $X_CFLAGS"
542 GL_LIB_DEPS="$X_LIBS -lX11 -lXext -lXxf86vm -lXdamage -lXfixes"
544 # XCB can only be used from pkg-config
545 if test "$enable_xcb" = yes; then
546 PKG_CHECK_MODULES([XCB],[x11-xcb xcb-glx])
547 X11_INCLUDES="$X11_INCLUDES $XCB_CFLAGS"
548 GL_LIB_DEPS="$GL_LIB_DEPS $XCB_LIBS"
552 # need DRM libs, -lpthread, etc.
553 GL_LIB_DEPS="$GL_LIB_DEPS $LIBDRM_LIBS -lm -lpthread $DLOPEN_LIBS $OS_LIBS"
556 # No libGL for osmesa
557 GL_LIB_DEPS="$OS_LIBS"
560 AC_SUBST([GL_LIB_DEPS])
565 if test "$mesa_driver" = xlib; then
566 DEFINES="$DEFINES -DUSE_XSHM"
572 AC_ARG_ENABLE([glx-tls],
573 [AS_HELP_STRING([--enable-glx-tls],
574 [enable TLS support in GLX @<:@default=disabled@:>@])],
575 [GLX_USE_TLS="$enableval"],
577 dnl Directory for DRI drivers
578 AC_ARG_WITH([dri-driverdir],
579 [AS_HELP_STRING([--with-dri-driverdir=DIR],
580 [directory for the DRI drivers @<:@${libdir}/dri@:>@])],
581 [DRI_DRIVER_INSTALL_DIR="$withval"],
582 [DRI_DRIVER_INSTALL_DIR='${libdir}/dri'])
583 AC_SUBST([DRI_DRIVER_INSTALL_DIR])
584 dnl Direct rendering or just indirect rendering
585 AC_ARG_ENABLE([driglx-direct],
586 [AS_HELP_STRING([--disable-driglx-direct],
587 [enable direct rendering in GLX for DRI @<:@default=enabled@:>@])],
588 [driglx_direct="$enableval"],
589 [driglx_direct="yes"])
591 AC_ARG_ENABLE([ttm-api],
592 [AS_HELP_STRING([--enable-ttm-api],
593 [enable TTM API users @<:@default=disabled@:>@])],
594 [ttmapi="$enableval"],
597 if test "x$ttmapi" = "xyes"; then
599 CFLAGS=$LIBDRM_CFLAGS
600 AC_CHECK_HEADERS([xf86mm.h],[],[AC_MSG_ERROR([xf86mm.h required for TTM.])],[#include "stdint.h"\n#include "drm.h"])
604 dnl Which drivers to build - default is chosen by platform
605 AC_ARG_WITH([dri-drivers],
606 [AS_HELP_STRING([--with-dri-drivers@<:@=DIRS...@:>@],
607 [comma delimited DRI drivers list, e.g.
608 "swrast,i965,radeon,nouveau" @<:@default=auto@:>@])],
609 [with_dri_drivers="$withval"],
610 [with_dri_drivers=yes])
611 if test "x$with_dri_drivers" = x; then
615 dnl If $with_dri_drivers is yes, directories will be added through
618 case "$with_dri_drivers" in
621 # verify the requested driver directories exist
622 dri_drivers=`IFS=,; echo $with_dri_drivers`
623 for driver in $dri_drivers; do
624 test -d "$srcdir/src/mesa/drivers/dri/$driver" || \
625 AC_MSG_ERROR([DRI driver directory '$driver' doesn't exist])
627 DRI_DIRS="$dri_drivers"
631 dnl Just default to no EGL for now
633 AC_SUBST([USING_EGL])
635 dnl Set DRI_DIRS, DEFINES and LIB_DEPS
636 if test "$mesa_driver" = dri; then
638 if test "x$GLX_USE_TLS" = xyes; then
639 DEFINES="$DEFINES -DGLX_USE_TLS -DPTHREADS"
642 if test "x$ttmapi" = xyes; then
643 DEFINES="$DEFINES -DTTM_API"
646 if test "x$USING_EGL" = x1; then
650 # Platform specific settings and drivers to build
653 DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
654 DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING -DHAVE_ALIAS"
655 if test "x$driglx_direct" = xyes; then
656 DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
661 # ffb, gamma, and sis are missing because they have not be
662 # converted to use the new interface. i810 are missing
663 # because there is no x86-64 system where they could *ever*
665 if test "x$DRI_DIRS" = x; then
666 DRI_DIRS="i915 i965 mach64 mga r128 r200 r300 radeon \
667 savage tdfx unichrome swrast"
671 # Build only the drivers for cards that exist on PowerPC.
672 # At some point MGA will be added, but not yet.
673 if test "x$DRI_DIRS" = x; then
674 DRI_DIRS="mach64 r128 r200 r300 radeon tdfx swrast"
678 # Build only the drivers for cards that exist on sparc`
679 if test "x$DRI_DIRS" = x; then
680 DRI_DIRS="mach64 r128 r200 r300 radeon ffb swrast"
685 freebsd* | dragonfly*)
686 DEFINES="$DEFINES -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1"
687 DEFINES="$DEFINES -DIN_DRI_DRIVER -DHAVE_ALIAS"
688 DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING"
689 if test "x$driglx_direct" = xyes; then
690 DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
692 if test "x$GXX" = xyes; then
693 CXXFLAGS="$CXXFLAGS -ansi -pedantic"
696 # ffb and gamma are missing because they have not been converted
697 # to use the new interface.
698 if test "x$DRI_DIRS" = x; then
699 DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 radeon tdfx \
700 unichrome savage sis swrast"
704 DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
705 DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING"
706 if test "x$driglx_direct" = xyes; then
707 DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
713 if test "x$DRI_DIRS" = x; then
714 DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 radeon s3v \
715 savage sis tdfx trident unichrome ffb swrast"
718 DRI_DIRS=`echo "$DRI_DIRS" | $SED 's/ */ /g'`
724 [AS_HELP_STRING([--with-expat=DIR],
725 [expat install directory])],[
726 EXPAT_INCLUDES="-I$withval/include"
727 CPPFLAGS="$CPPFLAGS $EXPAT_INCLUDES"
728 LDFLAGS="$LDFLAGS -L$withval/$LIB_DIR"
729 EXPAT_LIB="-L$withval/$LIB_DIR -lexpat"
731 AC_CHECK_HEADER([expat.h],[],[AC_MSG_ERROR([Expat required for DRI.])])
732 AC_CHECK_LIB([expat],[XML_ParserCreate],[],
733 [AC_MSG_ERROR([Expat required for DRI.])])
735 # put all the necessary libs together
736 DRI_LIB_DEPS="$SELINUX_LIBS $LIBDRM_LIBS $EXPAT_LIB -lm -lpthread $DLOPEN_LIBS"
739 AC_SUBST([EXPAT_INCLUDES])
740 AC_SUBST([DRI_LIB_DEPS])
743 dnl OSMesa configuration
745 if test "$mesa_driver" = xlib; then
746 default_gl_osmesa=yes
750 AC_ARG_ENABLE([gl-osmesa],
751 [AS_HELP_STRING([--enable-gl-osmesa],
752 [enable OSMesa on libGL @<:@default=enabled for xlib driver@:>@])],
753 [gl_osmesa="$enableval"],
754 [gl_osmesa="$default_gl_osmesa"])
755 if test "x$gl_osmesa" = xyes; then
756 if test "$mesa_driver" = osmesa; then
757 AC_MSG_ERROR([libGL is not available for OSMesa driver])
759 DRIVER_DIRS="$DRIVER_DIRS osmesa"
763 dnl Configure the channel bits for OSMesa (libOSMesa, libOSMesa16, ...)
764 AC_ARG_WITH([osmesa-bits],
765 [AS_HELP_STRING([--with-osmesa-bits=BITS],
766 [OSMesa channel bits and library name: 8, 16, 32 @<:@default=8@:>@])],
767 [osmesa_bits="$withval"],
769 if test "$mesa_driver" != osmesa && test "x$osmesa_bits" != x8; then
770 AC_MSG_WARN([Ignoring OSMesa channel bits for non-OSMesa driver])
773 case "x$osmesa_bits" in
778 OSMESA_LIB="OSMesa$osmesa_bits"
779 DEFINES="$DEFINES -DCHAN_BITS=$osmesa_bits -DDEFAULT_SOFTWARE_DEPTH_BITS=31"
782 AC_MSG_ERROR([OSMesa bits '$osmesa_bits' is not a valid option])
785 AC_SUBST([OSMESA_LIB])
787 case "$mesa_driver" in
789 # only link libraries with osmesa if shared
790 if test "$enable_static" = no; then
791 OSMESA_LIB_DEPS="-lm -lpthread $SELINUX_LIBS"
798 # Link OSMesa to libGL otherwise
800 # only link libraries with osmesa if shared
801 if test "$enable_static" = no; then
802 OSMESA_MESA_DEPS='-l$(GL_LIB)'
808 if test "$enable_static" = no; then
809 OSMESA_LIB_DEPS="$OSMESA_LIB_DEPS $OS_LIBS"
811 AC_SUBST([OSMESA_LIB_DEPS])
812 AC_SUBST([OSMESA_MESA_DEPS])
815 dnl GLU configuration
818 [AS_HELP_STRING([--disable-glu],
819 [enable OpenGL Utility library @<:@default=enabled@:>@])],
820 [enable_glu="$enableval"],
822 if test "x$enable_glu" = xyes; then
823 SRC_DIRS="$SRC_DIRS glu"
825 case "$mesa_driver" in
827 # If GLU is available and we have libOSMesa (not 16 or 32),
828 # we can build the osdemos
829 if test "$with_demos" = yes && test "$osmesa_bits" = 8; then
830 PROGRAM_DIRS="$PROGRAM_DIRS osdemos"
833 # Link libGLU to libOSMesa instead of libGL
835 if test "$enable_static" = no; then
836 GLU_MESA_DEPS='-l$(OSMESA_LIB)'
842 # If static, empty GLU_LIB_DEPS and add libs for programs to link
843 if test "$enable_static" = no; then
845 GLU_MESA_DEPS='-l$(GL_LIB)'
849 APP_LIB_DEPS="$APP_LIB_DEPS -lstdc++"
854 if test "$enable_static" = no; then
855 GLU_LIB_DEPS="$GLU_LIB_DEPS $OS_CPLUSPLUS_LIBS"
857 AC_SUBST([GLU_LIB_DEPS])
858 AC_SUBST([GLU_MESA_DEPS])
861 dnl GLw configuration
864 [AS_HELP_STRING([--disable-glw],
865 [enable Xt/Motif widget library @<:@default=enabled@:>@])],
866 [enable_glw="$enableval"],
868 dnl Don't build GLw on osmesa
869 if test "x$enable_glw" = xyes && test "$mesa_driver" = osmesa; then
870 AC_MSG_WARN([Disabling GLw since the driver is OSMesa])
873 if test "x$enable_glw" = xyes; then
874 SRC_DIRS="$SRC_DIRS glw"
875 if test "$x11_pkgconfig" = yes; then
876 PKG_CHECK_MODULES([GLW],[x11 xt])
877 GLW_LIB_DEPS="$GLW_LIBS"
879 # should check these...
880 GLW_LIB_DEPS="$X_LIBS -lX11 -lXt"
883 # If static, empty GLW_LIB_DEPS and add libs for programs to link
884 if test "$enable_static" = no; then
885 GLW_MESA_DEPS='-l$(GL_LIB)'
886 GLW_LIB_DEPS="$GLW_LIB_DEPS $OS_LIBS"
888 APP_LIB_DEPS="$APP_LIB_DEPS $GLW_LIB_DEPS"
893 AC_SUBST([GLW_LIB_DEPS])
894 AC_SUBST([GLW_MESA_DEPS])
897 dnl GLUT configuration
899 if test -f "$srcdir/include/GL/glut.h"; then
904 AC_ARG_ENABLE([glut],
905 [AS_HELP_STRING([--disable-glut],
906 [enable GLUT library @<:@default=enabled if source available@:>@])],
907 [enable_glut="$enableval"],
908 [enable_glut="$default_glut"])
910 dnl Can't build glut if GLU not available
911 if test "x$enable_glu$enable_glut" = xnoyes; then
912 AC_MSG_WARN([Disabling glut since GLU is disabled])
915 dnl Don't build glut on osmesa
916 if test "x$enable_glut" = xyes && test "$mesa_driver" = osmesa; then
917 AC_MSG_WARN([Disabling glut since the driver is OSMesa])
921 if test "x$enable_glut" = xyes; then
922 SRC_DIRS="$SRC_DIRS glut/glx"
924 if test "x$GCC" = xyes; then
925 GLUT_CFLAGS="-fexceptions"
927 if test "$x11_pkgconfig" = yes; then
928 PKG_CHECK_MODULES([GLUT],[x11 xmu xi])
929 GLUT_LIB_DEPS="$GLUT_LIBS"
931 # should check these...
932 GLUT_LIB_DEPS="$X_LIBS -lX11 -lXmu -lXi"
934 GLUT_LIB_DEPS="$GLUT_LIB_DEPS -lm $OS_LIBS"
936 # If glut is available, we can build most programs
937 if test "$with_demos" = yes; then
938 PROGRAM_DIRS="$PROGRAM_DIRS demos redbook samples glsl"
941 # If static, empty GLUT_LIB_DEPS and add libs for programs to link
942 if test "$enable_static" = no; then
943 GLUT_MESA_DEPS='-l$(GLU_LIB) -l$(GL_LIB)'
945 APP_LIB_DEPS="$APP_LIB_DEPS $GLUT_LIB_DEPS"
950 AC_SUBST([GLUT_LIB_DEPS])
951 AC_SUBST([GLUT_MESA_DEPS])
952 AC_SUBST([GLUT_CFLAGS])
955 dnl Program library dependencies
956 dnl Only libm is added here if necessary as the libraries should
957 dnl be pulled in by the linker
959 if test "x$APP_LIB_DEPS" = x; then
962 APP_LIB_DEPS="-lX11 -lsocket -lnsl -lm"
969 AC_SUBST([APP_LIB_DEPS])
970 AC_SUBST([PROGRAM_DIRS])
973 dnl Restore LDFLAGS and CPPFLAGS
974 LDFLAGS="$_SAVE_LDFLAGS"
975 CPPFLAGS="$_SAVE_CPPFLAGS"
977 dnl Substitute the config
978 AC_CONFIG_FILES([configs/autoconf])
980 dnl Replace the configs/current symlink
981 AC_CONFIG_COMMANDS([configs],[
982 if test -f configs/current || test -L configs/current; then
983 rm -f configs/current
985 ln -s autoconf configs/current
991 dnl Output some configuration info for the user
994 echo " prefix: $prefix"
995 echo " exec_prefix: $exec_prefix"
996 echo " libdir: $libdir"
997 echo " includedir: $includedir"
1001 echo " Driver: $mesa_driver"
1002 if echo "$DRIVER_DIRS" | grep 'osmesa' >/dev/null 2>&1; then
1003 echo " OSMesa: lib$OSMESA_LIB"
1007 if test "$mesa_driver" = dri; then
1008 # cleanup the drivers var
1009 dri_dirs=`echo $DRI_DIRS | $SED 's/^ *//;s/ */ /;s/ *$//'`
1010 echo " DRI drivers: $dri_dirs"
1011 echo " DRI driver dir: $DRI_DRIVER_INSTALL_DIR"
1012 echo " TTM API support: $ttmapi"
1017 echo " Shared libs: $enable_shared"
1018 echo " Static libs: $enable_static"
1019 echo " GLU: $enable_glu"
1020 echo " GLw: $enable_glw"
1021 echo " glut: $enable_glut"
1024 # cleanup the programs var for display
1025 program_dirs=`echo $PROGRAM_DIRS | $SED 's/^ *//;s/ */ /;s/ *$//'`
1026 if test "x$program_dirs" = x; then
1029 echo " Demos: $program_dirs"
1032 dnl Compiler options
1033 # cleanup the CFLAGS/CXXFLAGS/DEFINES vars
1034 cflags=`echo $CFLAGS $OPT_FLAGS $PIC_FLAGS $ARCH_FLAGS | \
1035 $SED 's/^ *//;s/ */ /;s/ *$//'`
1036 cxxflags=`echo $CXXFLAGS $OPT_FLAGS $PIC_FLAGS $ARCH_FLAGS | \
1037 $SED 's/^ *//;s/ */ /;s/ *$//'`
1038 defines=`echo $DEFINES $ASM_FLAGS | $SED 's/^ *//;s/ */ /;s/ *$//'`
1040 echo " CFLAGS: $cflags"
1041 echo " CXXFLAGS: $cxxflags"
1042 echo " Macros: $defines"
1045 echo " Run '${MAKE-make}' to build Mesa"