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_fatal([Failed to get the Mesa version from `make -f bin/version.mk version`])])
11 dnl Tell the user about autoconf.html in the --help output
12 m4_divert_once([HELP_END], [
13 See docs/autoconf.html for more details on the options for Mesa.])
15 AC_INIT([Mesa],[mesa_version],
16 [https://bugs.freedesktop.org/enter_bug.cgi?product=Mesa])
17 AC_CONFIG_AUX_DIR([bin])
20 dnl Versions for external dependencies
22 DRI2PROTO_REQUIRED=1.99.3
28 AC_CHECK_PROGS([MAKE], [gmake make])
29 AC_PATH_PROG([MKDEP], [makedepend])
30 AC_PATH_PROG([SED], [sed])
32 dnl We need a POSIX shell for parts of the build. Assume we have one
36 # Solaris /bin/sh is too old/non-POSIX compliant
37 AC_PATH_PROGS(POSIX_SHELL, [ksh93 ksh sh])
42 MKDEP_OPTIONS=-fdepend
43 dnl Ask gcc where it's keeping its secret headers
44 if test "x$GCC" = xyes; then
45 for dir in include include-fixed; do
46 GCC_INCLUDES=`$CC -print-file-name=$dir`
47 if test "x$GCC_INCLUDES" != x && \
48 test "$GCC_INCLUDES" != "$dir" && \
49 test -d "$GCC_INCLUDES"; then
50 MKDEP_OPTIONS="$MKDEP_OPTIONS -I$GCC_INCLUDES"
54 AC_SUBST([MKDEP_OPTIONS])
56 dnl Make sure the pkg-config macros are defined
57 m4_ifndef([PKG_PROG_PKG_CONFIG],
58 [m4_fatal([Could not locate the pkg-config autoconf macros.
59 These are usually located in /usr/share/aclocal/pkg.m4. If your macros
60 are in a different location, try setting the environment variable
61 ACLOCAL="aclocal -I/other/macro/dir" before running autoreconf.])])
64 dnl LIB_DIR - library basename
65 LIB_DIR=`echo $libdir | $SED 's%.*/%%'`
68 dnl Cache LDFLAGS so we can add EXTRA_LIB_PATH and restore it later
69 _SAVE_LDFLAGS="$LDFLAGS"
70 AC_ARG_VAR([EXTRA_LIB_PATH],[Extra -L paths for the linker])
71 AC_SUBST([EXTRA_LIB_PATH])
73 dnl Cache CPPFLAGS so we can add *_INCLUDES and restore it later
74 _SAVE_CPPFLAGS="$CPPFLAGS"
75 AC_ARG_VAR([X11_INCLUDES],[Extra -I paths for X11 headers])
76 AC_SUBST([X11_INCLUDES])
83 DEFINES="$DEFINES -D_GNU_SOURCE -DPTHREADS"
86 DEFINES="$DEFINES -DPTHREADS -DSVR4"
90 dnl Add flags for gcc and g++
91 if test "x$GCC" = xyes; then
92 CFLAGS="$CFLAGS -Wall -Wmissing-prototypes -std=c99 -ffast-math"
94 # Work around aliasing bugs - developers should comment this out
95 CFLAGS="$CFLAGS -fno-strict-aliasing"
97 if test "x$GXX" = xyes; then
98 CXXFLAGS="$CXXFLAGS -Wall"
100 # Work around aliasing bugs - developers should comment this out
101 CXXFLAGS="$CXXFLAGS -fno-strict-aliasing"
104 dnl These should be unnecessary, but let the user set them if they want
105 AC_ARG_VAR([OPT_FLAGS], [Additional optimization flags for the compiler.
106 Default is to use CFLAGS.])
107 AC_ARG_VAR([ARCH_FLAGS], [Additional architecture specific flags for the
108 compiler. Default is to use CFLAGS.])
109 AC_SUBST([OPT_FLAGS])
110 AC_SUBST([ARCH_FLAGS])
113 dnl Hacks to enable 32 or 64 bit build
115 AC_ARG_ENABLE([32-bit],
116 [AS_HELP_STRING([--enable-32-bit],
117 [build 32-bit libraries @<:@default=auto@:>@])],
118 [enable_32bit="$enableval"],
121 if test "x$enable_32bit" = xyes; then
122 if test "x$GCC" = xyes; then
123 CFLAGS="$CFLAGS -m32"
125 if test "x$GXX" = xyes; then
126 CXXFLAGS="$CXXFLAGS -m32"
129 AC_ARG_ENABLE([64-bit],
130 [AS_HELP_STRING([--enable-64-bit],
131 [build 64-bit libraries @<:@default=auto@:>@])],
132 [enable_64bit="$enableval"],
135 if test "x$enable_64bit" = xyes; then
136 if test "x$GCC" = xyes; then
137 CFLAGS="$CFLAGS -m64"
139 if test "x$GXX" = xyes; then
140 CXXFLAGS="$CXXFLAGS -m64"
145 dnl shared/static libraries, mimic libtool options
147 AC_ARG_ENABLE([static],
148 [AS_HELP_STRING([--enable-static],
149 [build static libraries @<:@default=disabled@:>@])],
150 [enable_static="$enableval"],
153 case "x$enable_static" in
155 x ) enable_static=no ;;
157 AC_MSG_ERROR([Static library option '$enable_static' is not a valid])
160 AC_ARG_ENABLE([shared],
161 [AS_HELP_STRING([--disable-shared],
162 [build shared libraries @<:@default=enabled@:>@])],
163 [enable_shared="$enableval"],
166 case "x$enable_shared" in
168 x ) enable_shared=yes ;;
170 AC_MSG_ERROR([Shared library option '$enable_shared' is not a valid])
174 dnl Can't have static and shared libraries, default to static if user
175 dnl explicitly requested. If both disabled, set to static since shared
176 dnl was explicitly requirested.
177 case "x$enable_static$enable_shared" in
179 AC_MSG_WARN([Can't build static and shared libraries, disabling shared])
183 AC_MSG_WARN([Can't disable both static and shared libraries, enabling static])
191 AC_ARG_VAR([MKLIB_OPTIONS],[Options for the Mesa library script, mklib])
192 if test "$enable_static" = yes; then
193 MKLIB_OPTIONS="$MKLIB_OPTIONS -static"
195 AC_SUBST([MKLIB_OPTIONS])
198 dnl other compiler options
200 AC_ARG_ENABLE([debug],
201 [AS_HELP_STRING([--enable-debug],
202 [use debug compiler flags and macros @<:@default=disabled@:>@])],
203 [enable_debug="$enableval"],
206 if test "x$enable_debug" = xyes; then
207 DEFINES="$DEFINES -DDEBUG"
208 if test "x$GCC" = xyes; then
211 if test "x$GXX" = xyes; then
212 CXXFLAGS="$CXXFLAGS -g"
219 if test "$enable_static" = yes; then
224 LIB_EXTENSION='dylib' ;;
226 LIB_EXTENSION='dll' ;;
228 LIB_EXTENSION='so' ;;
232 GL_LIB_NAME='lib$(GL_LIB).'${LIB_EXTENSION}
233 GLU_LIB_NAME='lib$(GLU_LIB).'${LIB_EXTENSION}
234 GLUT_LIB_NAME='lib$(GLUT_LIB).'${LIB_EXTENSION}
235 GLW_LIB_NAME='lib$(GLW_LIB).'${LIB_EXTENSION}
236 OSMESA_LIB_NAME='lib$(OSMESA_LIB).'${LIB_EXTENSION}
238 GL_LIB_GLOB='lib$(GL_LIB).*'${LIB_EXTENSION}'*'
239 GLU_LIB_GLOB='lib$(GLU_LIB).*'${LIB_EXTENSION}'*'
240 GLUT_LIB_GLOB='lib$(GLUT_LIB).*'${LIB_EXTENSION}'*'
241 GLW_LIB_GLOB='lib$(GLW_LIB).*'${LIB_EXTENSION}'*'
242 OSMESA_LIB_GLOB='lib$(OSMESA_LIB).*'${LIB_EXTENSION}'*'
244 AC_SUBST([GL_LIB_NAME])
245 AC_SUBST([GLU_LIB_NAME])
246 AC_SUBST([GLUT_LIB_NAME])
247 AC_SUBST([GLW_LIB_NAME])
248 AC_SUBST([OSMESA_LIB_NAME])
250 AC_SUBST([GL_LIB_GLOB])
251 AC_SUBST([GLU_LIB_GLOB])
252 AC_SUBST([GLUT_LIB_GLOB])
253 AC_SUBST([GLW_LIB_GLOB])
254 AC_SUBST([OSMESA_LIB_GLOB])
257 dnl Arch/platform-specific settings
260 [AS_HELP_STRING([--disable-asm],
261 [disable assembly usage @<:@default=enabled on supported plaforms@:>@])],
262 [enable_asm="$enableval"],
269 AC_MSG_CHECKING([whether to enable assembly])
270 test "x$enable_asm" = xno && AC_MSG_RESULT([no])
271 # disable if cross compiling on x86/x86_64 since we must run gen_matypes
272 if test "x$enable_asm" = xyes && test "x$cross_compiling" = xyes; then
276 AC_MSG_RESULT([no, cross compiling])
280 # check for supported arches
281 if test "x$enable_asm" = xyes; then
285 linux* | *freebsd* | dragonfly*)
286 test "x$enable_64bit" = xyes && asm_arch=x86_64 || asm_arch=x86
292 linux* | *freebsd* | dragonfly*)
293 test "x$enable_32bit" = xyes && asm_arch=x86 || asm_arch=x86_64
315 ASM_FLAGS="-DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM"
316 MESA_ASM_SOURCES='$(X86_SOURCES)'
317 GLAPI_ASM_SOURCES='$(X86_API)'
318 AC_MSG_RESULT([yes, x86])
321 ASM_FLAGS="-DUSE_X86_64_ASM"
322 MESA_ASM_SOURCES='$(X86-64_SOURCES)'
323 GLAPI_ASM_SOURCES='$(X86-64_API)'
324 AC_MSG_RESULT([yes, x86_64])
327 ASM_FLAGS="-DUSE_PPC_ASM -DUSE_VMX_ASM"
328 MESA_ASM_SOURCES='$(PPC_SOURCES)'
329 AC_MSG_RESULT([yes, ppc])
332 ASM_FLAGS="-DUSE_SPARC_ASM"
333 MESA_ASM_SOURCES='$(SPARC_SOURCES)'
334 GLAPI_ASM_SOURCES='$(SPARC_API)'
335 AC_MSG_RESULT([yes, sparc])
338 AC_MSG_RESULT([no, platform not supported])
342 AC_SUBST([ASM_FLAGS])
343 AC_SUBST([MESA_ASM_SOURCES])
344 AC_SUBST([GLAPI_ASM_SOURCES])
349 dnl Check to see if dlopen is in default libraries (like Solaris, which
350 dnl has it in libc), or if libdl is needed to get it.
351 AC_CHECK_FUNC([dlopen], [],
352 [AC_CHECK_LIB([dl], [dlopen], [DLOPEN_LIBS="-ldl"])])
354 dnl See if posix_memalign is available
355 AC_CHECK_FUNC([posix_memalign], [DEFINES="$DEFINES -DHAVE_POSIX_MEMALIGN"])
357 dnl SELinux awareness.
358 AC_ARG_ENABLE([selinux],
359 [AS_HELP_STRING([--enable-selinux],
360 [Build SELinux-aware Mesa @<:@default=disabled@:>@])],
361 [MESA_SELINUX="$enableval"],
363 if test "x$enable_selinux" = "xyes"; then
364 AC_CHECK_HEADER([selinux/selinux.h],[],
365 [AC_MSG_ERROR([SELinux headers not found])])
366 AC_CHECK_LIB([selinux],[is_selinux_enabled],[],
367 [AC_MSG_ERROR([SELinux library not found])])
368 SELINUX_LIBS="-lselinux"
369 DEFINES="$DEFINES -DMESA_SELINUX"
373 dnl Driver configuration. Options are xlib, dri and osmesa right now.
374 dnl More later: directfb, fbdev, ...
376 default_driver="xlib"
381 i*86|x86_64|powerpc*|sparc*) default_driver="dri";;
384 *freebsd* | dragonfly*)
386 i*86|x86_64|powerpc*|sparc*) default_driver="dri";;
391 AC_ARG_WITH([driver],
392 [AS_HELP_STRING([--with-driver=DRIVER],
393 [driver for Mesa: xlib,dri,osmesa @<:@default=dri when available, or xlib@:>@])],
394 [mesa_driver="$withval"],
395 [mesa_driver="$default_driver"])
396 dnl Check for valid option
397 case "x$mesa_driver" in
401 AC_MSG_ERROR([Driver '$mesa_driver' is not a valid option])
406 dnl Driver specific build directories
411 GALLIUM_DIRS="auxiliary drivers state_trackers"
412 GALLIUM_WINSYS_DIRS=""
413 GALLIUM_WINSYS_DRM_DIRS=""
414 GALLIUM_AUXILIARY_DIRS="draw translate cso_cache pipebuffer tgsi sct rtasm util indices"
415 GALLIUM_DRIVERS_DIRS="softpipe failover trace"
416 GALLIUM_STATE_TRACKERS_DIRS=""
418 case "$mesa_driver" in
421 GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS xlib"
424 SRC_DIRS="glx/x11 $SRC_DIRS"
427 GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS drm"
435 AC_SUBST([DRIVER_DIRS])
436 AC_SUBST([WINDOW_SYSTEM])
437 AC_SUBST([GALLIUM_DIRS])
438 AC_SUBST([GALLIUM_WINSYS_DIRS])
439 AC_SUBST([GALLIUM_WINSYS_DRM_DIRS])
440 AC_SUBST([GALLIUM_DRIVERS_DIRS])
441 AC_SUBST([GALLIUM_AUXILIARY_DIRS])
442 AC_SUBST([GALLIUM_STATE_TRACKERS_DIRS])
445 dnl User supplied program configuration
447 if test -d "$srcdir/progs/demos"; then
453 [AS_HELP_STRING([--with-demos@<:@=DIRS...@:>@],
454 [optional comma delimited demo directories to build
455 @<:@default=auto if source available@:>@])],
456 [with_demos="$withval"],
457 [with_demos="$default_demos"])
458 if test "x$with_demos" = x; then
462 dnl If $with_demos is yes, directories will be added as libs available
464 case "$with_demos" in
467 # If the driver isn't osmesa, we have libGL and can build xdemos
468 if test "$mesa_driver" != osmesa; then
469 PROGRAM_DIRS="xdemos"
473 # verify the requested demos directories exist
474 demos=`IFS=,; echo $with_demos`
475 for demo in $demos; do
476 test -d "$srcdir/progs/$demo" || \
477 AC_MSG_ERROR([Program directory '$demo' doesn't exist])
479 PROGRAM_DIRS="$demos"
484 dnl Find out if X is available. The variable have_x is set if libX11 is
485 dnl found to mimic AC_PATH_XTRA.
487 if test -n "$PKG_CONFIG"; then
488 AC_MSG_CHECKING([pkg-config files for X11 are available])
489 PKG_CHECK_EXISTS([x11],[
495 AC_MSG_RESULT([$x11_pkgconfig])
499 dnl Use the autoconf macro if no pkg-config files
500 if test "$x11_pkgconfig" = no; then
504 dnl Try to tell the user that the --x-* options are only used when
505 dnl pkg-config is not available. This must be right after AC_PATH_XTRA.
506 m4_divert_once([HELP_BEGIN],
507 [These options are only used when the X libraries cannot be found by the
508 pkg-config utility.])
510 dnl We need X for xlib and dri, so bomb now if it's not found
511 case "$mesa_driver" in
513 if test "$no_x" = yes; then
514 AC_MSG_ERROR([X11 development libraries needed for $mesa_driver driver])
519 dnl XCB - this is only used for GLX right now
521 [AS_HELP_STRING([--enable-xcb],
522 [use XCB for GLX @<:@default=disabled@:>@])],
523 [enable_xcb="$enableval"],
525 if test "x$enable_xcb" = xyes; then
526 DEFINES="$DEFINES -DUSE_XCB"
532 dnl libGL configuration per driver
534 case "$mesa_driver" in
536 if test "$x11_pkgconfig" = yes; then
537 PKG_CHECK_MODULES([XLIBGL], [x11 xext])
538 GL_PC_REQ_PRIV="x11 xext"
539 X11_INCLUDES="$X11_INCLUDES $XLIBGL_CFLAGS"
540 GL_LIB_DEPS="$XLIBGL_LIBS"
542 # should check these...
543 X11_INCLUDES="$X11_INCLUDES $X_CFLAGS"
544 GL_LIB_DEPS="$X_LIBS -lX11 -lXext"
545 GL_PC_LIB_PRIV="$GL_LIB_DEPS"
546 GL_PC_CFLAGS="$X11_INCLUDES"
548 GL_LIB_DEPS="$GL_LIB_DEPS $SELINUX_LIBS -lm -lpthread"
549 GL_PC_LIB_PRIV="$GL_PC_LIB_PRIV $SELINUX_LIBS -lm -lpthread"
551 # if static, move the external libraries to the programs
552 # and empty the libraries for libGL
553 if test "$enable_static" = yes; then
554 APP_LIB_DEPS="$APP_LIB_DEPS $GL_LIB_DEPS"
559 # DRI must be shared, I think
560 if test "$enable_static" = yes; then
561 AC_MSG_ERROR([Can't use static libraries for DRI drivers])
565 PKG_CHECK_MODULES([LIBDRM], [libdrm >= $LIBDRM_REQUIRED])
566 PKG_CHECK_MODULES([DRI2PROTO], [dri2proto >= $DRI2PROTO_REQUIRED])
567 GL_PC_REQ_PRIV="libdrm >= $LIBDRM_REQUIRED dri2proto >= $DRI2PROTO_REQUIRED"
568 DRI_PC_REQ_PRIV="libdrm >= $LIBDRM_REQUIRED"
570 # find the DRI deps for libGL
571 if test "$x11_pkgconfig" = yes; then
572 # add xcb modules if necessary
573 dri_modules="x11 xext xxf86vm xdamage xfixes"
574 if test "$enable_xcb" = yes; then
575 dri_modules="$dri_modules x11-xcb xcb-glx"
578 PKG_CHECK_MODULES([DRIGL], [$dri_modules])
579 GL_PC_REQ_PRIV="$GL_PC_REQ_PRIV $dri_modules"
580 X11_INCLUDES="$X11_INCLUDES $DRIGL_CFLAGS"
581 GL_LIB_DEPS="$DRIGL_LIBS"
583 # should check these...
584 X11_INCLUDES="$X11_INCLUDES $X_CFLAGS"
585 GL_LIB_DEPS="$X_LIBS -lX11 -lXext -lXxf86vm -lXdamage -lXfixes"
586 GL_PC_LIB_PRIV="$GL_LIB_DEPS"
587 GL_PC_CFLAGS="$X11_INCLUDES"
589 # XCB can only be used from pkg-config
590 if test "$enable_xcb" = yes; then
591 PKG_CHECK_MODULES([XCB],[x11-xcb xcb-glx])
592 GL_PC_REQ_PRIV="$GL_PC_REQ_PRIV x11-xcb xcb-glx"
593 X11_INCLUDES="$X11_INCLUDES $XCB_CFLAGS"
594 GL_LIB_DEPS="$GL_LIB_DEPS $XCB_LIBS"
598 # need DRM libs, -lpthread, etc.
599 GL_LIB_DEPS="$GL_LIB_DEPS $LIBDRM_LIBS -lm -lpthread $DLOPEN_LIBS"
600 GL_PC_LIB_PRIV="-lm -lpthread $DLOPEN_LIBS"
603 # No libGL for osmesa
607 AC_SUBST([GL_LIB_DEPS])
608 AC_SUBST([GL_PC_REQ_PRIV])
609 AC_SUBST([GL_PC_LIB_PRIV])
610 AC_SUBST([GL_PC_CFLAGS])
611 AC_SUBST([DRI_PC_REQ_PRIV])
616 if test "$mesa_driver" = xlib; then
617 DEFINES="$DEFINES -DUSE_XSHM"
623 AC_ARG_ENABLE([glx-tls],
624 [AS_HELP_STRING([--enable-glx-tls],
625 [enable TLS support in GLX @<:@default=disabled@:>@])],
626 [GLX_USE_TLS="$enableval"],
628 dnl Directory for DRI drivers
629 AC_ARG_WITH([dri-driverdir],
630 [AS_HELP_STRING([--with-dri-driverdir=DIR],
631 [directory for the DRI drivers @<:@${libdir}/dri@:>@])],
632 [DRI_DRIVER_INSTALL_DIR="$withval"],
633 [DRI_DRIVER_INSTALL_DIR='${libdir}/dri'])
634 AC_SUBST([DRI_DRIVER_INSTALL_DIR])
635 dnl Direct rendering or just indirect rendering
636 AC_ARG_ENABLE([driglx-direct],
637 [AS_HELP_STRING([--disable-driglx-direct],
638 [enable direct rendering in GLX for DRI @<:@default=enabled@:>@])],
639 [driglx_direct="$enableval"],
640 [driglx_direct="yes"])
641 dnl Which drivers to build - default is chosen by platform
642 AC_ARG_WITH([dri-drivers],
643 [AS_HELP_STRING([--with-dri-drivers@<:@=DIRS...@:>@],
644 [comma delimited DRI drivers list, e.g.
645 "swrast,i965,radeon,nouveau" @<:@default=auto@:>@])],
646 [with_dri_drivers="$withval"],
647 [with_dri_drivers=yes])
648 if test "x$with_dri_drivers" = x; then
652 dnl If $with_dri_drivers is yes, directories will be added through
655 case "$with_dri_drivers" in
661 # verify the requested driver directories exist
662 dri_drivers=`IFS=', '; echo $with_dri_drivers`
663 for driver in $dri_drivers; do
664 test -d "$srcdir/src/mesa/drivers/dri/$driver" || \
665 AC_MSG_ERROR([DRI driver directory '$driver' doesn't exist])
667 DRI_DIRS="$dri_drivers"
671 dnl Just default to no EGL for now
673 AC_SUBST([USING_EGL])
675 dnl Set DRI_DIRS, DEFINES and LIB_DEPS
676 if test "$mesa_driver" = dri; then
678 if test "x$GLX_USE_TLS" = xyes; then
679 DEFINES="$DEFINES -DGLX_USE_TLS -DPTHREADS"
682 if test "x$USING_EGL" = x1; then
686 # Platform specific settings and drivers to build
689 DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
690 if test "x$driglx_direct" = xyes; then
691 DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
693 DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING -DHAVE_ALIAS"
697 # ffb, gamma, and sis are missing because they have not be
698 # converted to use the new interface. i810 are missing
699 # because there is no x86-64 system where they could *ever*
701 if test "x$DRI_DIRS" = "xyes"; then
702 DRI_DIRS="i915 i965 mach64 mga r128 r200 r300 radeon \
703 savage tdfx unichrome swrast"
707 # Build only the drivers for cards that exist on PowerPC.
708 # At some point MGA will be added, but not yet.
709 if test "x$DRI_DIRS" = "xyes"; then
710 DRI_DIRS="mach64 r128 r200 r300 radeon tdfx swrast"
714 # Build only the drivers for cards that exist on sparc`
715 if test "x$DRI_DIRS" = "xyes"; then
716 DRI_DIRS="mach64 r128 r200 r300 radeon ffb swrast"
721 freebsd* | dragonfly*)
722 DEFINES="$DEFINES -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1"
723 DEFINES="$DEFINES -DIN_DRI_DRIVER -DHAVE_ALIAS"
724 DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING"
725 if test "x$driglx_direct" = xyes; then
726 DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
728 if test "x$GXX" = xyes; then
729 CXXFLAGS="$CXXFLAGS -ansi -pedantic"
732 # ffb and gamma are missing because they have not been converted
733 # to use the new interface.
734 if test "x$DRI_DIRS" = "xyes"; then
735 DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 radeon tdfx \
736 unichrome savage sis swrast"
740 DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
741 DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING -DHAVE_ALIAS"
744 DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
745 DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING"
746 if test "x$driglx_direct" = xyes; then
747 DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
753 if test "x$DRI_DIRS" = "xyes"; then
754 DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 radeon s3v \
755 savage sis tdfx trident unichrome ffb swrast"
758 DRI_DIRS=`echo "$DRI_DIRS" | $SED 's/ */ /g'`
764 [AS_HELP_STRING([--with-expat=DIR],
765 [expat install directory])],[
766 EXPAT_INCLUDES="-I$withval/include"
767 CPPFLAGS="$CPPFLAGS $EXPAT_INCLUDES"
768 LDFLAGS="$LDFLAGS -L$withval/$LIB_DIR"
769 EXPAT_LIB="-L$withval/$LIB_DIR -lexpat"
771 AC_CHECK_HEADER([expat.h],[],[AC_MSG_ERROR([Expat required for DRI.])])
772 AC_CHECK_LIB([expat],[XML_ParserCreate],[],
773 [AC_MSG_ERROR([Expat required for DRI.])])
775 # put all the necessary libs together
776 DRI_LIB_DEPS="$SELINUX_LIBS $LIBDRM_LIBS $EXPAT_LIB -lm -lpthread $DLOPEN_LIBS"
779 AC_SUBST([EXPAT_INCLUDES])
780 AC_SUBST([DRI_LIB_DEPS])
783 dnl OSMesa configuration
785 if test "$mesa_driver" = xlib; then
786 default_gl_osmesa=yes
790 AC_ARG_ENABLE([gl-osmesa],
791 [AS_HELP_STRING([--enable-gl-osmesa],
792 [enable OSMesa on libGL @<:@default=enabled for xlib driver@:>@])],
793 [gl_osmesa="$enableval"],
794 [gl_osmesa="$default_gl_osmesa"])
795 if test "x$gl_osmesa" = xyes; then
796 if test "$mesa_driver" = osmesa; then
797 AC_MSG_ERROR([libGL is not available for OSMesa driver])
799 DRIVER_DIRS="$DRIVER_DIRS osmesa"
803 dnl Configure the channel bits for OSMesa (libOSMesa, libOSMesa16, ...)
804 AC_ARG_WITH([osmesa-bits],
805 [AS_HELP_STRING([--with-osmesa-bits=BITS],
806 [OSMesa channel bits and library name: 8, 16, 32 @<:@default=8@:>@])],
807 [osmesa_bits="$withval"],
809 if test "$mesa_driver" != osmesa && test "x$osmesa_bits" != x8; then
810 AC_MSG_WARN([Ignoring OSMesa channel bits for non-OSMesa driver])
813 case "x$osmesa_bits" in
818 OSMESA_LIB="OSMesa$osmesa_bits"
819 DEFINES="$DEFINES -DCHAN_BITS=$osmesa_bits -DDEFAULT_SOFTWARE_DEPTH_BITS=31"
822 AC_MSG_ERROR([OSMesa bits '$osmesa_bits' is not a valid option])
825 AC_SUBST([OSMESA_LIB])
827 case "$mesa_driver" in
829 # only link libraries with osmesa if shared
830 if test "$enable_static" = no; then
831 OSMESA_LIB_DEPS="-lm -lpthread $SELINUX_LIBS $DLOPEN_LIBS"
836 OSMESA_PC_LIB_PRIV="-lm -lpthread $SELINUX_LIBS $DLOPEN_LIBS"
839 # Link OSMesa to libGL otherwise
841 # only link libraries with osmesa if shared
842 if test "$enable_static" = no; then
843 OSMESA_MESA_DEPS='-l$(GL_LIB)'
850 OSMESA_PC_LIB_PRIV="$OSMESA_PC_LIB_PRIV"
851 AC_SUBST([OSMESA_LIB_DEPS])
852 AC_SUBST([OSMESA_MESA_DEPS])
853 AC_SUBST([OSMESA_PC_REQ])
854 AC_SUBST([OSMESA_PC_LIB_PRIV])
857 dnl EGL configuration
860 [AS_HELP_STRING([--disable-egl],
861 [disable EGL library @<:@default=enabled@:>@])],
862 [enable_egl="$enableval"],
864 if test "x$enable_egl" = xyes; then
865 SRC_DIRS="$SRC_DIRS egl"
867 if test "$x11_pkgconfig" = yes; then
868 PKG_CHECK_MODULES([EGL], [x11])
869 EGL_LIB_DEPS="$EGL_LIBS"
871 # should check these...
872 EGL_LIB_DEPS="$X_LIBS -lX11"
874 EGL_LIB_DEPS="$EGL_LIB_DEPS $DLOPEN_LIBS"
876 AC_SUBST([EGL_LIB_DEPS])
879 dnl GLU configuration
882 [AS_HELP_STRING([--disable-glu],
883 [enable OpenGL Utility library @<:@default=enabled@:>@])],
884 [enable_glu="$enableval"],
886 if test "x$enable_glu" = xyes; then
887 SRC_DIRS="$SRC_DIRS glu"
889 case "$mesa_driver" in
891 # If GLU is available and we have libOSMesa (not 16 or 32),
892 # we can build the osdemos
893 if test "$with_demos" = yes && test "$osmesa_bits" = 8; then
894 PROGRAM_DIRS="$PROGRAM_DIRS osdemos"
897 # Link libGLU to libOSMesa instead of libGL
900 if test "$enable_static" = no; then
901 GLU_MESA_DEPS='-l$(OSMESA_LIB)'
907 # If static, empty GLU_LIB_DEPS and add libs for programs to link
909 GLU_PC_LIB_PRIV="-lm"
910 if test "$enable_static" = no; then
912 GLU_MESA_DEPS='-l$(GL_LIB)'
916 APP_LIB_DEPS="$APP_LIB_DEPS -lstdc++"
921 if test "$enable_static" = no; then
922 GLU_LIB_DEPS="$GLU_LIB_DEPS $OS_CPLUSPLUS_LIBS"
924 GLU_PC_LIB_PRIV="$GLU_PC_LIB_PRIV $OS_CPLUSPLUS_LIBS"
925 AC_SUBST([GLU_LIB_DEPS])
926 AC_SUBST([GLU_MESA_DEPS])
927 AC_SUBST([GLU_PC_REQ])
928 AC_SUBST([GLU_PC_REQ_PRIV])
929 AC_SUBST([GLU_PC_LIB_PRIV])
930 AC_SUBST([GLU_PC_CFLAGS])
933 dnl GLw configuration
936 [AS_HELP_STRING([--disable-glw],
937 [enable Xt/Motif widget library @<:@default=enabled@:>@])],
938 [enable_glw="$enableval"],
940 dnl Don't build GLw on osmesa
941 if test "x$enable_glw" = xyes && test "$mesa_driver" = osmesa; then
942 AC_MSG_WARN([Disabling GLw since the driver is OSMesa])
945 AC_ARG_ENABLE([motif],
946 [AS_HELP_STRING([--enable-motif],
947 [use Motif widgets in GLw @<:@default=disabled@:>@])],
948 [enable_motif="$enableval"],
951 if test "x$enable_glw" = xyes; then
952 SRC_DIRS="$SRC_DIRS glw"
953 if test "$x11_pkgconfig" = yes; then
954 PKG_CHECK_MODULES([GLW],[x11 xt])
955 GLW_PC_REQ_PRIV="x11 xt"
956 GLW_LIB_DEPS="$GLW_LIBS"
958 # should check these...
959 GLW_LIB_DEPS="$X_LIBS -lXt -lX11"
960 GLW_PC_LIB_PRIV="$GLW_LIB_DEPS"
961 GLW_PC_CFLAGS="$X11_INCLUDES"
964 GLW_SOURCES="GLwDrawA.c"
966 if test "x$enable_motif" = xyes; then
967 GLW_SOURCES="$GLW_SOURCES GLwMDrawA.c"
968 AC_PATH_PROG([MOTIF_CONFIG], [motif-config], [no])
969 if test "x$MOTIF_CONFIG" != xno; then
970 MOTIF_CFLAGS=`$MOTIF_CONFIG --cflags`
971 MOTIF_LIBS=`$MOTIF_CONFIG --libs`
973 AC_CHECK_HEADER([Xm/PrimitiveP.h], [],
974 [AC_MSG_ERROR([Can't locate Motif headers])])
975 AC_CHECK_LIB([Xm], [XmGetPixmap], [MOTIF_LIBS="-lXm"],
976 [AC_MSG_ERROR([Can't locate Motif Xm library])])
978 # MOTIF_LIBS is prepended to GLW_LIB_DEPS since Xm needs Xt/X11
979 GLW_LIB_DEPS="$MOTIF_LIBS $GLW_LIB_DEPS"
980 GLW_PC_LIB_PRIV="$MOTIF_LIBS $GLW_PC_LIB_PRIV"
981 GLW_PC_CFLAGS="$MOTIF_CFLAGS $GLW_PC_CFLAGS"
984 # If static, empty GLW_LIB_DEPS and add libs for programs to link
985 GLW_PC_LIB_PRIV="$GLW_PC_LIB_PRIV"
986 if test "$enable_static" = no; then
987 GLW_MESA_DEPS='-l$(GL_LIB)'
988 GLW_LIB_DEPS="$GLW_LIB_DEPS"
990 APP_LIB_DEPS="$APP_LIB_DEPS $GLW_LIB_DEPS"
995 AC_SUBST([GLW_LIB_DEPS])
996 AC_SUBST([GLW_MESA_DEPS])
997 AC_SUBST([GLW_SOURCES])
998 AC_SUBST([MOTIF_CFLAGS])
999 AC_SUBST([GLW_PC_REQ_PRIV])
1000 AC_SUBST([GLW_PC_LIB_PRIV])
1001 AC_SUBST([GLW_PC_CFLAGS])
1004 dnl GLUT configuration
1006 if test -f "$srcdir/include/GL/glut.h"; then
1011 AC_ARG_ENABLE([glut],
1012 [AS_HELP_STRING([--disable-glut],
1013 [enable GLUT library @<:@default=enabled if source available@:>@])],
1014 [enable_glut="$enableval"],
1015 [enable_glut="$default_glut"])
1017 dnl Can't build glut if GLU not available
1018 if test "x$enable_glu$enable_glut" = xnoyes; then
1019 AC_MSG_WARN([Disabling glut since GLU is disabled])
1022 dnl Don't build glut on osmesa
1023 if test "x$enable_glut" = xyes && test "$mesa_driver" = osmesa; then
1024 AC_MSG_WARN([Disabling glut since the driver is OSMesa])
1028 if test "x$enable_glut" = xyes; then
1029 SRC_DIRS="$SRC_DIRS glut/glx"
1031 if test "x$GCC" = xyes; then
1032 GLUT_CFLAGS="-fexceptions"
1034 if test "$x11_pkgconfig" = yes; then
1035 PKG_CHECK_MODULES([GLUT],[x11 xmu xi])
1036 GLUT_PC_REQ_PRIV="x11 xmu xi"
1037 GLUT_LIB_DEPS="$GLUT_LIBS"
1039 # should check these...
1040 GLUT_LIB_DEPS="$X_LIBS -lX11 -lXmu -lXi"
1041 GLUT_PC_LIB_PRIV="$GLUT_LIB_DEPS"
1042 GLUT_PC_CFLAGS="$X11_INCLUDES"
1044 GLUT_LIB_DEPS="$GLUT_LIB_DEPS -lm"
1045 GLUT_PC_LIB_PRIV="$GLUT_PC_LIB_PRIV -lm"
1047 # If glut is available, we can build most programs
1048 if test "$with_demos" = yes; then
1049 PROGRAM_DIRS="$PROGRAM_DIRS demos redbook samples glsl"
1052 # If static, empty GLUT_LIB_DEPS and add libs for programs to link
1053 if test "$enable_static" = no; then
1054 GLUT_MESA_DEPS='-l$(GLU_LIB) -l$(GL_LIB)'
1056 APP_LIB_DEPS="$APP_LIB_DEPS $GLUT_LIB_DEPS"
1061 AC_SUBST([GLUT_LIB_DEPS])
1062 AC_SUBST([GLUT_MESA_DEPS])
1063 AC_SUBST([GLUT_CFLAGS])
1064 AC_SUBST([GLUT_PC_REQ_PRIV])
1065 AC_SUBST([GLUT_PC_LIB_PRIV])
1066 AC_SUBST([GLUT_PC_CFLAGS])
1069 dnl Program library dependencies
1070 dnl Only libm is added here if necessary as the libraries should
1071 dnl be pulled in by the linker
1073 if test "x$APP_LIB_DEPS" = x; then
1076 APP_LIB_DEPS="-lX11 -lsocket -lnsl -lm"
1079 APP_LIB_DEPS="-lX11"
1086 AC_SUBST([APP_LIB_DEPS])
1087 AC_SUBST([PROGRAM_DIRS])
1090 dnl Gallium configuration
1092 AC_ARG_ENABLE([gallium],
1093 [AS_HELP_STRING([--disable-gallium],
1094 [build gallium @<:@default=enabled@:>@])],
1095 [enable_gallium="$enableval"],
1096 [enable_gallium=yes])
1097 if test "x$enable_gallium" = xyes; then
1098 SRC_DIRS="$SRC_DIRS gallium gallium/winsys"
1102 dnl Gallium state trackers configuration
1104 AC_ARG_WITH([state-trackers],
1105 [AS_HELP_STRING([--with-state-trackers@<:@=DIRS...@:>@],
1106 [comma delimited state_trackers list, e.g.
1107 "egl,glx" @<:@default=auto@:>@])],
1108 [with_state_trackers="$withval"],
1109 [with_state_trackers=yes])
1111 case "$with_state_trackers" in
1113 GALLIUM_STATE_TRACKERS_DIRS=""
1116 # look at what else is built
1117 case "$mesa_driver" in
1119 GALLIUM_STATE_TRACKERS_DIRS=glx
1122 test "x$enable_egl" = xyes && GALLIUM_STATE_TRACKERS_DIRS=egl
1127 # verify the requested state tracker exist
1128 state_trackers=`IFS=', '; echo $with_state_trackers`
1129 for tracker in $state_trackers; do
1130 test -d "$srcdir/src/gallium/state_trackers/$tracker" || \
1131 AC_MSG_ERROR([state tracker '$tracker' doesn't exist])
1133 if test "$tracker" = egl && test "x$enable_egl" != xyes; then
1134 AC_MSG_ERROR([cannot build egl state tracker without EGL library])
1137 GALLIUM_STATE_TRACKERS_DIRS="$state_trackers"
1141 AC_ARG_WITH([xorg-driver-dir],
1142 [AS_HELP_STRING([--with-xorg-driver-dir=DIR],
1143 [Default xorg driver directory[[default=${libdir}/xorg/modules/drivers]]])],
1144 [XORG_DRIVER_INSTALL_DIR="$withval"],
1145 [XORG_DRIVER_INSTALL_DIR="${libdir}/xorg/modules/drivers"])
1146 AC_SUBST([XORG_DRIVER_INSTALL_DIR])
1149 dnl Gallium Intel configuration
1151 AC_ARG_ENABLE([gallium-intel],
1152 [AS_HELP_STRING([--disable-gallium-intel],
1153 [build gallium intel @<:@default=enabled@:>@])],
1154 [enable_gallium_intel="$enableval"],
1155 [enable_gallium_intel=yes])
1156 if test "x$enable_gallium_intel" = xyes; then
1157 GALLIUM_WINSYS_DRM_DIRS="$GALLIUM_WINSYS_DRM_DIRS intel"
1158 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS i915simple"
1162 dnl Gallium Radeon configuration
1164 AC_ARG_ENABLE([gallium-radeon],
1165 [AS_HELP_STRING([--enable-gallium-radeon],
1166 [build gallium radeon @<:@default=disabled@:>@])],
1167 [enable_gallium_radeon="$enableval"],
1168 [enable_gallium_radeon=no])
1169 if test "x$enable_gallium_radeon" = xyes; then
1170 GALLIUM_WINSYS_DRM_DIRS="$GALLIUM_WINSYS_DRM_DIRS radeon"
1171 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r300"
1175 dnl Gallium Radeon configuration
1177 AC_ARG_ENABLE([gallium-nouveau],
1178 [AS_HELP_STRING([--enable-gallium-nouveau],
1179 [build gallium nouveau @<:@default=disabled@:>@])],
1180 [enable_gallium_nouveau="$enableval"],
1181 [enable_gallium_nouveau=no])
1182 if test "x$enable_gallium_nouveau" = xyes; then
1183 GALLIUM_WINSYS_DRM_DIRS="$GALLIUM_WINSYS_DRM_DIRS nouveau"
1184 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS nv04 nv10 nv20 nv30 nv40 nv50"
1188 dnl Restore LDFLAGS and CPPFLAGS
1189 LDFLAGS="$_SAVE_LDFLAGS"
1190 CPPFLAGS="$_SAVE_CPPFLAGS"
1192 dnl Substitute the config
1193 AC_CONFIG_FILES([configs/autoconf])
1195 dnl Replace the configs/current symlink
1196 AC_CONFIG_COMMANDS([configs],[
1197 if test -f configs/current || test -L configs/current; then
1198 rm -f configs/current
1200 ln -s autoconf configs/current
1206 dnl Output some configuration info for the user
1209 echo " prefix: $prefix"
1210 echo " exec_prefix: $exec_prefix"
1211 echo " libdir: $libdir"
1212 echo " includedir: $includedir"
1216 echo " Driver: $mesa_driver"
1217 if echo "$DRIVER_DIRS" | grep 'osmesa' >/dev/null 2>&1; then
1218 echo " OSMesa: lib$OSMESA_LIB"
1222 if test "$mesa_driver" = dri; then
1223 # cleanup the drivers var
1224 dri_dirs=`echo $DRI_DIRS | $SED 's/^ *//;s/ */ /;s/ *$//'`
1225 if test "x$DRI_DIRS" = x; then
1226 echo " DRI drivers: no"
1228 echo " DRI drivers: $dri_dirs"
1230 echo " DRI driver dir: $DRI_DRIVER_INSTALL_DIR"
1232 echo " Use XCB: $enable_xcb"
1235 if echo "$SRC_DIRS" | grep 'gallium' >/dev/null 2>&1; then
1236 echo " Gallium: yes"
1237 echo " Gallium dirs: $GALLIUM_DIRS"
1238 echo " Winsys dirs: $GALLIUM_WINSYS_DIRS"
1239 echo " Winsys drm dirs:$GALLIUM_WINSYS_DRM_DIRS"
1240 echo " Auxiliary dirs: $GALLIUM_AUXILIARY_DIRS"
1241 echo " Driver dirs: $GALLIUM_DRIVERS_DIRS"
1242 echo " Trackers dirs: $GALLIUM_STATE_TRACKERS_DIRS"
1249 echo " Shared libs: $enable_shared"
1250 echo " Static libs: $enable_static"
1251 echo " EGL: $enable_egl"
1252 echo " GLU: $enable_glu"
1253 echo " GLw: $enable_glw (Motif: $enable_motif)"
1254 echo " glut: $enable_glut"
1257 # cleanup the programs var for display
1258 program_dirs=`echo $PROGRAM_DIRS | $SED 's/^ *//;s/ */ /;s/ *$//'`
1259 if test "x$program_dirs" = x; then
1262 echo " Demos: $program_dirs"
1265 dnl Compiler options
1266 # cleanup the CFLAGS/CXXFLAGS/DEFINES vars
1267 cflags=`echo $CFLAGS $OPT_FLAGS $PIC_FLAGS $ARCH_FLAGS | \
1268 $SED 's/^ *//;s/ */ /;s/ *$//'`
1269 cxxflags=`echo $CXXFLAGS $OPT_FLAGS $PIC_FLAGS $ARCH_FLAGS | \
1270 $SED 's/^ *//;s/ */ /;s/ *$//'`
1271 defines=`echo $DEFINES $ASM_FLAGS | $SED 's/^ *//;s/ */ /;s/ *$//'`
1273 echo " CFLAGS: $cflags"
1274 echo " CXXFLAGS: $cxxflags"
1275 echo " Macros: $defines"
1278 echo " Run '${MAKE-make}' to build Mesa"