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.99.3
32 AC_CHECK_PROGS([MAKE], [gmake make])
33 AC_PATH_PROG([MKDEP], [makedepend])
34 AC_PATH_PROG([SED], [sed])
36 dnl We need a POSIX shell for parts of the build. Assume we have one
40 # Solaris /bin/sh is too old/non-POSIX compliant
41 AC_PATH_PROGS(POSIX_SHELL, [ksh93 ksh sh])
46 MKDEP_OPTIONS=-fdepend
47 dnl Ask gcc where it's keeping its secret headers
48 if test "x$GCC" = xyes; then
49 for dir in include include-fixed; do
50 GCC_INCLUDES=`$CC -print-file-name=$dir`
51 if test "x$GCC_INCLUDES" != x && \
52 test "$GCC_INCLUDES" != "$dir" && \
53 test -d "$GCC_INCLUDES"; then
54 MKDEP_OPTIONS="$MKDEP_OPTIONS -I$GCC_INCLUDES"
58 AC_SUBST([MKDEP_OPTIONS])
60 dnl Make sure the pkg-config macros are defined
61 m4_ifdef([PKG_PROG_PKG_CONFIG],[],[
62 m4_errprint([Error: Could not locate the pkg-config autoconf macros.
63 These are usually located in /usr/share/aclocal/pkg.m4. If your
64 macros are in a different location, try setting the environment
65 variable ACLOCAL="aclocal -I/other/macro/dir" before running
72 dnl LIB_DIR - library basename
73 LIB_DIR=`echo $libdir | $SED 's%.*/%%'`
76 dnl Cache LDFLAGS so we can add EXTRA_LIB_PATH and restore it later
77 _SAVE_LDFLAGS="$LDFLAGS"
78 AC_ARG_VAR([EXTRA_LIB_PATH],[Extra -L paths for the linker])
79 AC_SUBST([EXTRA_LIB_PATH])
81 dnl Cache CPPFLAGS so we can add *_INCLUDES and restore it later
82 _SAVE_CPPFLAGS="$CPPFLAGS"
83 AC_ARG_VAR([X11_INCLUDES],[Extra -I paths for X11 headers])
84 AC_SUBST([X11_INCLUDES])
91 DEFINES="$DEFINES -D_GNU_SOURCE -DPTHREADS"
94 DEFINES="$DEFINES -DPTHREADS -DSVR4"
98 dnl Add flags for gcc and g++
99 if test "x$GCC" = xyes; then
100 CFLAGS="$CFLAGS -Wall -Wmissing-prototypes -std=c99 -ffast-math"
102 # Work around aliasing bugs - developers should comment this out
103 CFLAGS="$CFLAGS -fno-strict-aliasing"
105 if test "x$GXX" = xyes; then
106 CXXFLAGS="$CXXFLAGS -Wall"
108 # Work around aliasing bugs - developers should comment this out
109 CXXFLAGS="$CXXFLAGS -fno-strict-aliasing"
112 dnl These should be unnecessary, but let the user set them if they want
113 AC_ARG_VAR([OPT_FLAGS], [Additional optimization flags for the compiler.
114 Default is to use CFLAGS.])
115 AC_ARG_VAR([ARCH_FLAGS], [Additional architecture specific flags for the
116 compiler. Default is to use CFLAGS.])
117 AC_SUBST([OPT_FLAGS])
118 AC_SUBST([ARCH_FLAGS])
121 dnl Hacks to enable 32 or 64 bit build
123 AC_ARG_ENABLE([32-bit],
124 [AS_HELP_STRING([--enable-32-bit],
125 [build 32-bit libraries @<:@default=auto@:>@])],
126 [enable_32bit="$enableval"],
129 if test "x$enable_32bit" = xyes; then
130 if test "x$GCC" = xyes; then
131 CFLAGS="$CFLAGS -m32"
133 if test "x$GXX" = xyes; then
134 CXXFLAGS="$CXXFLAGS -m32"
137 AC_ARG_ENABLE([64-bit],
138 [AS_HELP_STRING([--enable-64-bit],
139 [build 64-bit libraries @<:@default=auto@:>@])],
140 [enable_64bit="$enableval"],
143 if test "x$enable_64bit" = xyes; then
144 if test "x$GCC" = xyes; then
145 CFLAGS="$CFLAGS -m64"
147 if test "x$GXX" = xyes; then
148 CXXFLAGS="$CXXFLAGS -m64"
153 dnl shared/static libraries, mimic libtool options
155 AC_ARG_ENABLE([static],
156 [AS_HELP_STRING([--enable-static],
157 [build static libraries @<:@default=disabled@:>@])],
158 [enable_static="$enableval"],
161 case "x$enable_static" in
163 x ) enable_static=no ;;
165 AC_MSG_ERROR([Static library option '$enable_static' is not a valid])
168 AC_ARG_ENABLE([shared],
169 [AS_HELP_STRING([--disable-shared],
170 [build shared libraries @<:@default=enabled@:>@])],
171 [enable_shared="$enableval"],
174 case "x$enable_shared" in
176 x ) enable_shared=yes ;;
178 AC_MSG_ERROR([Shared library option '$enable_shared' is not a valid])
182 dnl Can't have static and shared libraries, default to static if user
183 dnl explicitly requested. If both disabled, set to static since shared
184 dnl was explicitly requirested.
185 case "x$enable_static$enable_shared" in
187 AC_MSG_WARN([Can't build static and shared libraries, disabling shared])
191 AC_MSG_WARN([Can't disable both static and shared libraries, enabling static])
199 AC_ARG_VAR([MKLIB_OPTIONS],[Options for the Mesa library script, mklib])
200 if test "$enable_static" = yes; then
201 MKLIB_OPTIONS="$MKLIB_OPTIONS -static"
203 AC_SUBST([MKLIB_OPTIONS])
206 dnl other compiler options
208 AC_ARG_ENABLE([debug],
209 [AS_HELP_STRING([--enable-debug],
210 [use debug compiler flags and macros @<:@default=disabled@:>@])],
211 [enable_debug="$enableval"],
214 if test "x$enable_debug" = xyes; then
215 DEFINES="$DEFINES -DDEBUG"
216 if test "x$GCC" = xyes; then
219 if test "x$GXX" = xyes; then
220 CXXFLAGS="$CXXFLAGS -g"
227 if test "$enable_static" = yes; then
228 GL_LIB_NAME='lib$(GL_LIB).a'
229 GLU_LIB_NAME='lib$(GLU_LIB).a'
230 GLUT_LIB_NAME='lib$(GLUT_LIB).a'
231 GLW_LIB_NAME='lib$(GLW_LIB).a'
232 OSMESA_LIB_NAME='lib$(OSMESA_LIB).a'
236 LIB_EXTENSION='dylib' ;;
238 LIB_EXTENSION='so' ;;
241 GL_LIB_NAME='lib$(GL_LIB).'${LIB_EXTENSION}
242 GLU_LIB_NAME='lib$(GLU_LIB).'${LIB_EXTENSION}
243 GLUT_LIB_NAME='lib$(GLUT_LIB).'${LIB_EXTENSION}
244 GLW_LIB_NAME='lib$(GLW_LIB).'${LIB_EXTENSION}
245 OSMESA_LIB_NAME='lib$(OSMESA_LIB).'${LIB_EXTENSION}
247 GL_LIB_GLOB='lib$(GL_LIB).*'${LIB_EXTENSION}'*'
248 GLU_LIB_GLOB='lib$(GLU_LIB).*'${LIB_EXTENSION}'*'
249 GLUT_LIB_GLOB='lib$(GLUT_LIB).*'${LIB_EXTENSION}'*'
250 GLW_LIB_GLOB='lib$(GLW_LIB).*'${LIB_EXTENSION}'*'
251 OSMESA_LIB_GLOB='lib$(OSMESA_LIB).*'${LIB_EXTENSION}'*'
253 AC_SUBST([GL_LIB_NAME])
254 AC_SUBST([GLU_LIB_NAME])
255 AC_SUBST([GLUT_LIB_NAME])
256 AC_SUBST([GLW_LIB_NAME])
257 AC_SUBST([OSMESA_LIB_NAME])
259 AC_SUBST([GL_LIB_GLOB])
260 AC_SUBST([GLU_LIB_GLOB])
261 AC_SUBST([GLUT_LIB_GLOB])
262 AC_SUBST([GLW_LIB_GLOB])
263 AC_SUBST([OSMESA_LIB_GLOB])
266 dnl Arch/platform-specific settings
269 [AS_HELP_STRING([--disable-asm],
270 [disable assembly usage @<:@default=enabled on supported plaforms@:>@])],
271 [enable_asm="$enableval"],
278 AC_MSG_CHECKING([whether to enable assembly])
279 test "x$enable_asm" = xno && AC_MSG_RESULT([no])
280 # disable if cross compiling on x86/x86_64 since we must run gen_matypes
281 if test "x$enable_asm" = xyes && test "x$cross_compiling" = xyes; then
285 AC_MSG_RESULT([no, cross compiling])
289 # check for supported arches
290 if test "x$enable_asm" = xyes; then
294 linux* | *freebsd* | dragonfly*)
295 test "x$enable_64bit" = xyes && asm_arch=x86_64 || asm_arch=x86
301 linux* | *freebsd* | dragonfly*)
302 test "x$enable_32bit" = xyes && asm_arch=x86 || asm_arch=x86_64
317 dnl ASM_FLAGS="-DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM"
318 ASM_SOURCES='$(X86_SOURCES)'
320 AC_MSG_RESULT([yes, x86])
323 ASM_FLAGS="-DUSE_X86_64_ASM"
324 ASM_SOURCES='$(X86-64_SOURCES)'
325 ASM_API='$(X86-64_API)'
326 AC_MSG_RESULT([yes, x86_64])
329 ASM_FLAGS="-DUSE_PPC_ASM -DUSE_VMX_ASM"
330 ASM_SOURCES='$(PPC_SOURCES)'
331 AC_MSG_RESULT([yes, ppc])
334 AC_MSG_RESULT([no, platform not supported])
338 AC_SUBST([ASM_FLAGS])
339 AC_SUBST([ASM_SOURCES])
345 dnl Check to see if dlopen is in default libraries (like Solaris, which
346 dnl has it in libc), or if libdl is needed to get it.
347 AC_CHECK_FUNC([dlopen], [],
348 [AC_CHECK_LIB([dl], [dlopen], [DLOPEN_LIBS="-ldl"])])
350 dnl See if posix_memalign is available
351 AC_CHECK_FUNC([posix_memalign], [DEFINES="$DEFINES -DHAVE_POSIX_MEMALIGN"])
353 dnl SELinux awareness.
354 AC_ARG_ENABLE([selinux],
355 [AS_HELP_STRING([--enable-selinux],
356 [Build SELinux-aware Mesa @<:@default=disabled@:>@])],
357 [MESA_SELINUX="$enableval"],
359 if test "x$enable_selinux" = "xyes"; then
360 AC_CHECK_HEADER([selinux/selinux.h],[],
361 [AC_MSG_ERROR([SELinux headers not found])])
362 AC_CHECK_LIB([selinux],[is_selinux_enabled],[],
363 [AC_MSG_ERROR([SELinux library not found])])
364 SELINUX_LIBS="-lselinux"
365 DEFINES="$DEFINES -DMESA_SELINUX"
368 dnl OS-specific libraries
373 if test "x$GXX" != xyes; then
374 OS_CPLUSPLUS_LIBS="-lCrun $OS_LIBS"
380 dnl Driver configuration. Options are xlib, dri and osmesa right now.
381 dnl More later: directfb, fbdev, ...
383 default_driver="xlib"
388 i*86|x86_64|powerpc*) default_driver="dri";;
391 *freebsd* | dragonfly*)
393 i*86|x86_64) default_driver="dri";;
398 AC_ARG_WITH([driver],
399 [AS_HELP_STRING([--with-driver=DRIVER],
400 [driver for Mesa: xlib,dri,osmesa @<:@default=dri when available, or xlib@:>@])],
401 [mesa_driver="$withval"],
402 [mesa_driver="$default_driver"])
403 dnl Check for valid option
404 case "x$mesa_driver" in
408 AC_MSG_ERROR([Driver '$mesa_driver' is not a valid option])
413 dnl Driver specific build directories
415 SRC_DIRS="mesa gallium egl gallium/winsys"
418 GALLIUM_WINSYS_DIRS=""
419 GALLIUM_AUXILIARY_DIRS="draw translate cso_cache pipebuffer tgsi sct rtasm util"
420 GALLIUM_DRIVER_DIRS="softpipe failover"
421 case "$mesa_driver" in
426 SRC_DIRS="glx/x11 $SRC_DIRS"
429 GALLIUM_WINSYS_DIRS="drm $GALLIUM_WINSYS_DIRS"
430 GALLIUM_DRIVER_DIRS="$GALLIUM_DRIVER_DIRS i915simple i965simple nv04 nv10 nv20 nv30 nv40 nv50"
438 AC_SUBST([DRIVER_DIRS])
439 AC_SUBST([WINDOW_SYSTEM])
440 AC_SUBST([GALLIUM_WINSYS_DIRS])
441 AC_SUBST([GALLIUM_DRIVER_DIRS])
442 AC_SUBST([GALLIUM_AUXILIARY_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 $OS_LIBS"
549 GL_PC_LIB_PRIV="$GL_PC_LIB_PRIV $SELINUX_LIBS -lm -lpthread $OS_LIBS"
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 $OS_LIBS"
600 GL_PC_LIB_PRIV="-lm -lpthread $DLOPEN_LIBS $OS_LIBS"
603 # No libGL for osmesa
604 GL_LIB_DEPS="$OS_LIBS"
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"
742 if test "x$driglx_direct" = xyes; then
743 DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
749 if test "x$DRI_DIRS" = "xyes"; then
750 DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 radeon s3v \
751 savage sis tdfx trident unichrome ffb swrast"
754 DRI_DIRS=`echo "$DRI_DIRS" | $SED 's/ */ /g'`
760 [AS_HELP_STRING([--with-expat=DIR],
761 [expat install directory])],[
762 EXPAT_INCLUDES="-I$withval/include"
763 CPPFLAGS="$CPPFLAGS $EXPAT_INCLUDES"
764 LDFLAGS="$LDFLAGS -L$withval/$LIB_DIR"
765 EXPAT_LIB="-L$withval/$LIB_DIR -lexpat"
767 AC_CHECK_HEADER([expat.h],[],[AC_MSG_ERROR([Expat required for DRI.])])
768 AC_CHECK_LIB([expat],[XML_ParserCreate],[],
769 [AC_MSG_ERROR([Expat required for DRI.])])
771 # put all the necessary libs together
772 DRI_LIB_DEPS="$SELINUX_LIBS $LIBDRM_LIBS $EXPAT_LIB -lm -lpthread $DLOPEN_LIBS"
775 AC_SUBST([EXPAT_INCLUDES])
776 AC_SUBST([DRI_LIB_DEPS])
779 dnl OSMesa configuration
781 if test "$mesa_driver" = xlib; then
782 default_gl_osmesa=yes
786 AC_ARG_ENABLE([gl-osmesa],
787 [AS_HELP_STRING([--enable-gl-osmesa],
788 [enable OSMesa on libGL @<:@default=enabled for xlib driver@:>@])],
789 [gl_osmesa="$enableval"],
790 [gl_osmesa="$default_gl_osmesa"])
791 if test "x$gl_osmesa" = xyes; then
792 if test "$mesa_driver" = osmesa; then
793 AC_MSG_ERROR([libGL is not available for OSMesa driver])
795 DRIVER_DIRS="$DRIVER_DIRS osmesa"
799 dnl Configure the channel bits for OSMesa (libOSMesa, libOSMesa16, ...)
800 AC_ARG_WITH([osmesa-bits],
801 [AS_HELP_STRING([--with-osmesa-bits=BITS],
802 [OSMesa channel bits and library name: 8, 16, 32 @<:@default=8@:>@])],
803 [osmesa_bits="$withval"],
805 if test "$mesa_driver" != osmesa && test "x$osmesa_bits" != x8; then
806 AC_MSG_WARN([Ignoring OSMesa channel bits for non-OSMesa driver])
809 case "x$osmesa_bits" in
814 OSMESA_LIB="OSMesa$osmesa_bits"
815 DEFINES="$DEFINES -DCHAN_BITS=$osmesa_bits -DDEFAULT_SOFTWARE_DEPTH_BITS=31"
818 AC_MSG_ERROR([OSMesa bits '$osmesa_bits' is not a valid option])
821 AC_SUBST([OSMESA_LIB])
823 case "$mesa_driver" in
825 # only link libraries with osmesa if shared
826 if test "$enable_static" = no; then
827 OSMESA_LIB_DEPS="-lm -lpthread $SELINUX_LIBS"
832 OSMESA_PC_LIB_PRIV="-lm -lpthread $SELINUX_LIBS"
835 # Link OSMesa to libGL otherwise
837 # only link libraries with osmesa if shared
838 if test "$enable_static" = no; then
839 OSMESA_MESA_DEPS='-l$(GL_LIB)'
846 if test "$enable_static" = no; then
847 OSMESA_LIB_DEPS="$OSMESA_LIB_DEPS $OS_LIBS"
849 OSMESA_PC_LIB_PRIV="$OSMESA_PC_LIB_PRIV $OS_LIBS"
850 AC_SUBST([OSMESA_LIB_DEPS])
851 AC_SUBST([OSMESA_MESA_DEPS])
852 AC_SUBST([OSMESA_PC_REQ])
853 AC_SUBST([OSMESA_PC_LIB_PRIV])
856 dnl GLU configuration
859 [AS_HELP_STRING([--disable-glu],
860 [enable OpenGL Utility library @<:@default=enabled@:>@])],
861 [enable_glu="$enableval"],
863 if test "x$enable_glu" = xyes; then
864 SRC_DIRS="$SRC_DIRS glu"
866 case "$mesa_driver" in
868 # If GLU is available and we have libOSMesa (not 16 or 32),
869 # we can build the osdemos
870 if test "$with_demos" = yes && test "$osmesa_bits" = 8; then
871 PROGRAM_DIRS="$PROGRAM_DIRS osdemos"
874 # Link libGLU to libOSMesa instead of libGL
877 if test "$enable_static" = no; then
878 GLU_MESA_DEPS='-l$(OSMESA_LIB)'
884 # If static, empty GLU_LIB_DEPS and add libs for programs to link
886 GLU_PC_LIB_PRIV="-lm"
887 if test "$enable_static" = no; then
889 GLU_MESA_DEPS='-l$(GL_LIB)'
893 APP_LIB_DEPS="$APP_LIB_DEPS -lstdc++"
898 if test "$enable_static" = no; then
899 GLU_LIB_DEPS="$GLU_LIB_DEPS $OS_CPLUSPLUS_LIBS"
901 GLU_PC_LIB_PRIV="$GLU_PC_LIB_PRIV $OS_CPLUSPLUS_LIBS"
902 AC_SUBST([GLU_LIB_DEPS])
903 AC_SUBST([GLU_MESA_DEPS])
904 AC_SUBST([GLU_PC_REQ])
905 AC_SUBST([GLU_PC_REQ_PRIV])
906 AC_SUBST([GLU_PC_LIB_PRIV])
907 AC_SUBST([GLU_PC_CFLAGS])
910 dnl GLw configuration
913 [AS_HELP_STRING([--disable-glw],
914 [enable Xt/Motif widget library @<:@default=enabled@:>@])],
915 [enable_glw="$enableval"],
917 dnl Don't build GLw on osmesa
918 if test "x$enable_glw" = xyes && test "$mesa_driver" = osmesa; then
919 AC_MSG_WARN([Disabling GLw since the driver is OSMesa])
922 AC_ARG_ENABLE([motif],
923 [AS_HELP_STRING([--enable-motif],
924 [use Motif widgets in GLw @<:@default=disabled@:>@])],
925 [enable_motif="$enableval"],
928 if test "x$enable_glw" = xyes; then
929 SRC_DIRS="$SRC_DIRS glw"
930 if test "$x11_pkgconfig" = yes; then
931 PKG_CHECK_MODULES([GLW],[x11 xt])
932 GLW_PC_REQ_PRIV="x11 xt"
933 GLW_LIB_DEPS="$GLW_LIBS"
935 # should check these...
936 GLW_LIB_DEPS="$X_LIBS -lXt -lX11"
937 GLW_PC_LIB_PRIV="$GLW_LIB_DEPS"
938 GLW_PC_CFLAGS="$X11_INCLUDES"
941 GLW_SOURCES="GLwDrawA.c"
943 if test "x$enable_motif" = xyes; then
944 GLW_SOURCES="$GLW_SOURCES GLwMDrawA.c"
945 AC_PATH_PROG([MOTIF_CONFIG], [motif-config], [no])
946 if test "x$MOTIF_CONFIG" != xno; then
947 MOTIF_CFLAGS=`$MOTIF_CONFIG --cflags`
948 MOTIF_LIBS=`$MOTIF_CONFIG --libs`
950 AC_CHECK_HEADER([Xm/PrimitiveP.h], [],
951 [AC_MSG_ERROR([Can't locate Motif headers])])
952 AC_CHECK_LIB([Xm], [XmGetPixmap], [MOTIF_LIBS="-lXm"],
953 [AC_MSG_ERROR([Can't locate Motif Xm library])])
955 # MOTIF_LIBS is prepended to GLW_LIB_DEPS since Xm needs Xt/X11
956 GLW_LIB_DEPS="$MOTIF_LIBS $GLW_LIB_DEPS"
957 GLW_PC_LIB_PRIV="$MOTIF_LIBS $GLW_PC_LIB_PRIV"
958 GLW_PC_CFLAGS="$MOTIF_CFLAGS $GLW_PC_CFLAGS"
961 # If static, empty GLW_LIB_DEPS and add libs for programs to link
962 GLW_PC_LIB_PRIV="$GLW_PC_LIB_PRIV $OS_LIBS"
963 if test "$enable_static" = no; then
964 GLW_MESA_DEPS='-l$(GL_LIB)'
965 GLW_LIB_DEPS="$GLW_LIB_DEPS $OS_LIBS"
967 APP_LIB_DEPS="$APP_LIB_DEPS $GLW_LIB_DEPS"
972 AC_SUBST([GLW_LIB_DEPS])
973 AC_SUBST([GLW_MESA_DEPS])
974 AC_SUBST([GLW_SOURCES])
975 AC_SUBST([MOTIF_CFLAGS])
976 AC_SUBST([GLW_PC_REQ_PRIV])
977 AC_SUBST([GLW_PC_LIB_PRIV])
978 AC_SUBST([GLW_PC_CFLAGS])
981 dnl GLUT configuration
983 if test -f "$srcdir/include/GL/glut.h"; then
988 AC_ARG_ENABLE([glut],
989 [AS_HELP_STRING([--disable-glut],
990 [enable GLUT library @<:@default=enabled if source available@:>@])],
991 [enable_glut="$enableval"],
992 [enable_glut="$default_glut"])
994 dnl Can't build glut if GLU not available
995 if test "x$enable_glu$enable_glut" = xnoyes; then
996 AC_MSG_WARN([Disabling glut since GLU is disabled])
999 dnl Don't build glut on osmesa
1000 if test "x$enable_glut" = xyes && test "$mesa_driver" = osmesa; then
1001 AC_MSG_WARN([Disabling glut since the driver is OSMesa])
1005 if test "x$enable_glut" = xyes; then
1006 SRC_DIRS="$SRC_DIRS glut/glx"
1008 if test "x$GCC" = xyes; then
1009 GLUT_CFLAGS="-fexceptions"
1011 if test "$x11_pkgconfig" = yes; then
1012 PKG_CHECK_MODULES([GLUT],[x11 xmu xi])
1013 GLUT_PC_REQ_PRIV="x11 xmu xi"
1014 GLUT_LIB_DEPS="$GLUT_LIBS"
1016 # should check these...
1017 GLUT_LIB_DEPS="$X_LIBS -lX11 -lXmu -lXi"
1018 GLUT_PC_LIB_PRIV="$GLUT_LIB_DEPS"
1019 GLUT_PC_CFLAGS="$X11_INCLUDES"
1021 GLUT_LIB_DEPS="$GLUT_LIB_DEPS -lm $OS_LIBS"
1022 GLUT_PC_LIB_PRIV="$GLUT_PC_LIB_PRIV -lm $OS_LIBS"
1024 # If glut is available, we can build most programs
1025 if test "$with_demos" = yes; then
1026 PROGRAM_DIRS="$PROGRAM_DIRS demos redbook samples glsl"
1029 # If static, empty GLUT_LIB_DEPS and add libs for programs to link
1030 if test "$enable_static" = no; then
1031 GLUT_MESA_DEPS='-l$(GLU_LIB) -l$(GL_LIB)'
1033 APP_LIB_DEPS="$APP_LIB_DEPS $GLUT_LIB_DEPS"
1038 AC_SUBST([GLUT_LIB_DEPS])
1039 AC_SUBST([GLUT_MESA_DEPS])
1040 AC_SUBST([GLUT_CFLAGS])
1041 AC_SUBST([GLUT_PC_REQ_PRIV])
1042 AC_SUBST([GLUT_PC_LIB_PRIV])
1043 AC_SUBST([GLUT_PC_CFLAGS])
1046 dnl Program library dependencies
1047 dnl Only libm is added here if necessary as the libraries should
1048 dnl be pulled in by the linker
1050 if test "x$APP_LIB_DEPS" = x; then
1053 APP_LIB_DEPS="-lX11 -lsocket -lnsl -lm"
1060 AC_SUBST([APP_LIB_DEPS])
1061 AC_SUBST([PROGRAM_DIRS])
1064 dnl Restore LDFLAGS and CPPFLAGS
1065 LDFLAGS="$_SAVE_LDFLAGS"
1066 CPPFLAGS="$_SAVE_CPPFLAGS"
1068 dnl Substitute the config
1069 AC_CONFIG_FILES([configs/autoconf])
1071 dnl Replace the configs/current symlink
1072 AC_CONFIG_COMMANDS([configs],[
1073 if test -f configs/current || test -L configs/current; then
1074 rm -f configs/current
1076 ln -s autoconf configs/current
1082 dnl Output some configuration info for the user
1085 echo " prefix: $prefix"
1086 echo " exec_prefix: $exec_prefix"
1087 echo " libdir: $libdir"
1088 echo " includedir: $includedir"
1092 echo " Driver: $mesa_driver"
1093 if echo "$DRIVER_DIRS" | grep 'osmesa' >/dev/null 2>&1; then
1094 echo " OSMesa: lib$OSMESA_LIB"
1098 if test "$mesa_driver" = dri; then
1099 # cleanup the drivers var
1100 dri_dirs=`echo $DRI_DIRS | $SED 's/^ *//;s/ */ /;s/ *$//'`
1101 if test "x$DRI_DIRS" = x; then
1102 echo " DRI drivers: no"
1104 echo " DRI drivers: $dri_dirs"
1106 echo " DRI driver dir: $DRI_DRIVER_INSTALL_DIR"
1108 echo " Use XCB: $enable_xcb"
1112 echo " Shared libs: $enable_shared"
1113 echo " Static libs: $enable_static"
1114 echo " GLU: $enable_glu"
1115 echo " GLw: $enable_glw (Motif: $enable_motif)"
1116 echo " glut: $enable_glut"
1119 # cleanup the programs var for display
1120 program_dirs=`echo $PROGRAM_DIRS | $SED 's/^ *//;s/ */ /;s/ *$//'`
1121 if test "x$program_dirs" = x; then
1124 echo " Demos: $program_dirs"
1127 dnl Compiler options
1128 # cleanup the CFLAGS/CXXFLAGS/DEFINES vars
1129 cflags=`echo $CFLAGS $OPT_FLAGS $PIC_FLAGS $ARCH_FLAGS | \
1130 $SED 's/^ *//;s/ */ /;s/ *$//'`
1131 cxxflags=`echo $CXXFLAGS $OPT_FLAGS $PIC_FLAGS $ARCH_FLAGS | \
1132 $SED 's/^ *//;s/ */ /;s/ *$//'`
1133 defines=`echo $DEFINES $ASM_FLAGS | $SED 's/^ *//;s/ */ /;s/ *$//'`
1135 echo " CFLAGS: $cflags"
1136 echo " CXXFLAGS: $cxxflags"
1137 echo " Macros: $defines"
1140 echo " Run '${MAKE-make}' to build Mesa"