OSDN Git Service

Add configure options for MAX_WIDTH/HEIGHT.
[android-x86/external-mesa.git] / configure.ac
1 dnl Process this file with autoconf to create configure.
2
3 AC_PREREQ([2.59])
4
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`])])
10
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.])
14
15 AC_INIT([Mesa],[mesa_version],
16     [https://bugs.freedesktop.org/enter_bug.cgi?product=Mesa])
17 AC_CONFIG_AUX_DIR([bin])
18 AC_CANONICAL_HOST
19
20 dnl Versions for external dependencies
21 LIBDRM_REQUIRED=2.4.3
22 DRI2PROTO_REQUIRED=1.99.3
23
24 dnl Check for progs
25 AC_PROG_CPP
26 AC_PROG_CC
27 AC_PROG_CXX
28 AC_CHECK_PROGS([MAKE], [gmake make])
29 AC_PATH_PROG([MKDEP], [makedepend])
30 AC_PATH_PROG([SED], [sed])
31
32 dnl We need a POSIX shell for parts of the build. Assume we have one
33 dnl in most cases.
34 case "$host_os" in
35 solaris*)
36     # Solaris /bin/sh is too old/non-POSIX compliant
37     AC_PATH_PROGS(POSIX_SHELL, [ksh93 ksh sh])
38     SHELL="$POSIX_SHELL"
39     ;;
40 esac
41
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"
51         fi
52     done
53 fi
54 AC_SUBST([MKDEP_OPTIONS])
55
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.])])
62 PKG_PROG_PKG_CONFIG()
63
64 dnl LIB_DIR - library basename
65 LIB_DIR=`echo $libdir | $SED 's%.*/%%'`
66 AC_SUBST([LIB_DIR])
67
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])
72
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])
77
78 dnl Compiler macros
79 DEFINES=""
80 AC_SUBST([DEFINES])
81 case "$host_os" in
82 linux*|*-gnu*|gnu*)
83     DEFINES="$DEFINES -D_GNU_SOURCE -DPTHREADS"
84     ;;
85 solaris*)
86     DEFINES="$DEFINES -DPTHREADS -DSVR4"
87     ;;
88 esac
89
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"
93
94     # Work around aliasing bugs - developers should comment this out
95     CFLAGS="$CFLAGS -fno-strict-aliasing"
96 fi
97 if test "x$GXX" = xyes; then
98     CXXFLAGS="$CXXFLAGS -Wall"
99
100     # Work around aliasing bugs - developers should comment this out
101     CXXFLAGS="$CXXFLAGS -fno-strict-aliasing"
102 fi
103
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])
111
112 dnl
113 dnl Hacks to enable 32 or 64 bit build
114 dnl
115 AC_ARG_ENABLE([32-bit],
116     [AS_HELP_STRING([--enable-32-bit],
117         [build 32-bit libraries @<:@default=auto@:>@])],
118     [enable_32bit="$enableval"],
119     [enable_32bit=auto]
120 )
121 if test "x$enable_32bit" = xyes; then
122     if test "x$GCC" = xyes; then
123         CFLAGS="$CFLAGS -m32"
124     fi
125     if test "x$GXX" = xyes; then
126         CXXFLAGS="$CXXFLAGS -m32"
127     fi
128 fi
129 AC_ARG_ENABLE([64-bit],
130     [AS_HELP_STRING([--enable-64-bit],
131         [build 64-bit libraries @<:@default=auto@:>@])],
132     [enable_64bit="$enableval"],
133     [enable_64bit=auto]
134 )
135 if test "x$enable_64bit" = xyes; then
136     if test "x$GCC" = xyes; then
137         CFLAGS="$CFLAGS -m64"
138     fi
139     if test "x$GXX" = xyes; then
140         CXXFLAGS="$CXXFLAGS -m64"
141     fi
142 fi
143
144 dnl
145 dnl shared/static libraries, mimic libtool options
146 dnl
147 AC_ARG_ENABLE([static],
148     [AS_HELP_STRING([--enable-static],
149         [build static libraries @<:@default=disabled@:>@])],
150     [enable_static="$enableval"],
151     [enable_static=no]
152 )
153 case "x$enable_static" in
154 xyes|xno ) ;;
155 x ) enable_static=no ;;
156 * )
157     AC_MSG_ERROR([Static library option '$enable_static' is not a valid])
158     ;;
159 esac
160 AC_ARG_ENABLE([shared],
161     [AS_HELP_STRING([--disable-shared],
162         [build shared libraries @<:@default=enabled@:>@])],
163     [enable_shared="$enableval"],
164     [enable_shared=yes]
165 )
166 case "x$enable_shared" in
167 xyes|xno ) ;;
168 x ) enable_shared=yes ;;
169 * )
170     AC_MSG_ERROR([Shared library option '$enable_shared' is not a valid])
171     ;;
172 esac
173
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
178 xyesyes )
179     AC_MSG_WARN([Can't build static and shared libraries, disabling shared])
180     enable_shared=no
181     ;;
182 xnono )
183     AC_MSG_WARN([Can't disable both static and shared libraries, enabling static])
184     enable_static=yes
185     ;;
186 esac
187
188 dnl
189 dnl mklib options
190 dnl
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"
194 fi
195 AC_SUBST([MKLIB_OPTIONS])
196
197 dnl
198 dnl other compiler options
199 dnl
200 AC_ARG_ENABLE([debug],
201     [AS_HELP_STRING([--enable-debug],
202         [use debug compiler flags and macros @<:@default=disabled@:>@])],
203     [enable_debug="$enableval"],
204     [enable_debug=no]
205 )
206 if test "x$enable_debug" = xyes; then
207     DEFINES="$DEFINES -DDEBUG"
208     if test "x$GCC" = xyes; then
209         CFLAGS="$CFLAGS -g"
210     fi
211     if test "x$GXX" = xyes; then
212         CXXFLAGS="$CXXFLAGS -g"
213     fi
214 fi
215
216 dnl
217 dnl library names
218 dnl
219 if test "$enable_static" = yes; then
220     LIB_EXTENSION='a'
221 else
222     case "$host_os" in
223     darwin* )
224         LIB_EXTENSION='dylib' ;;
225     cygwin* )
226         LIB_EXTENSION='dll' ;;
227     * )
228         LIB_EXTENSION='so' ;;
229     esac
230 fi
231
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}
237
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}'*'
243
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])
249
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])
255
256 dnl
257 dnl Arch/platform-specific settings
258 dnl
259 AC_ARG_ENABLE([asm],
260     [AS_HELP_STRING([--disable-asm],
261         [disable assembly usage @<:@default=enabled on supported plaforms@:>@])],
262     [enable_asm="$enableval"],
263     [enable_asm=yes]
264 )
265 asm_arch=""
266 ASM_FLAGS=""
267 MESA_ASM_SOURCES=""
268 GLAPI_ASM_SOURCES=""
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
273     case "$host_cpu" in
274     i?86 | x86_64)
275         enable_asm=no
276         AC_MSG_RESULT([no, cross compiling])
277         ;;
278     esac
279 fi
280 # check for supported arches
281 if test "x$enable_asm" = xyes; then
282     case "$host_cpu" in
283     i?86)
284         case "$host_os" in
285         linux* | *freebsd* | dragonfly*)
286             test "x$enable_64bit" = xyes && asm_arch=x86_64 || asm_arch=x86
287             ;;
288         esac
289         ;;
290     x86_64)
291         case "$host_os" in
292         linux* | *freebsd* | dragonfly*)
293             test "x$enable_32bit" = xyes && asm_arch=x86 || asm_arch=x86_64
294             ;;
295         esac
296         ;;
297     powerpc)
298         case "$host_os" in
299         linux*)
300             asm_arch=ppc
301             ;;
302         esac
303         ;;
304     sparc*)
305         case "$host_os" in
306         linux*)
307             asm_arch=sparc
308             ;;
309         esac
310         ;;
311     esac
312
313     case "$asm_arch" in
314     x86)
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])
319         ;;
320     x86_64)
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])
325         ;;
326     ppc)
327         ASM_FLAGS="-DUSE_PPC_ASM -DUSE_VMX_ASM"
328         MESA_ASM_SOURCES='$(PPC_SOURCES)'
329         AC_MSG_RESULT([yes, ppc])
330         ;;
331     sparc)
332         ASM_FLAGS="-DUSE_SPARC_ASM"
333         MESA_ASM_SOURCES='$(SPARC_SOURCES)'
334         GLAPI_ASM_SOURCES='$(SPARC_API)'
335         AC_MSG_RESULT([yes, sparc])
336         ;;
337     *)
338         AC_MSG_RESULT([no, platform not supported])
339         ;;
340     esac
341 fi
342 AC_SUBST([ASM_FLAGS])
343 AC_SUBST([MESA_ASM_SOURCES])
344 AC_SUBST([GLAPI_ASM_SOURCES])
345
346 dnl PIC code macro
347 MESA_PIC_FLAGS
348
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"])])
353
354 dnl See if posix_memalign is available
355 AC_CHECK_FUNC([posix_memalign], [DEFINES="$DEFINES -DHAVE_POSIX_MEMALIGN"])
356
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"],
362     [MESA_SELINUX=no])
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"
370 fi
371
372 dnl
373 dnl Driver configuration. Options are xlib, dri and osmesa right now.
374 dnl More later: directfb, fbdev, ...
375 dnl
376 default_driver="xlib"
377
378 case "$host_os" in
379 linux*)
380     case "$host_cpu" in
381     i*86|x86_64|powerpc*|sparc*) default_driver="dri";;
382     esac
383     ;;
384 *freebsd* | dragonfly*)
385     case "$host_cpu" in
386     i*86|x86_64|powerpc*|sparc*) default_driver="dri";;
387     esac
388     ;;
389 esac
390
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
398 xxlib|xdri|xosmesa)
399     ;;
400 *)
401     AC_MSG_ERROR([Driver '$mesa_driver' is not a valid option])
402     ;;
403 esac
404
405 dnl
406 dnl Driver specific build directories
407 dnl
408 SRC_DIRS="mesa glew"
409 GLU_DIRS="sgi"
410 WINDOW_SYSTEM=""
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=""
417
418 case "$mesa_driver" in
419 xlib)
420     DRIVER_DIRS="x11"
421     GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS xlib"
422     ;;
423 dri)
424     SRC_DIRS="glx/x11 $SRC_DIRS"
425     DRIVER_DIRS="dri"
426     WINDOW_SYSTEM="dri"
427     GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS drm"
428     ;;
429 osmesa)
430     DRIVER_DIRS="osmesa"
431     ;;
432 esac
433 AC_SUBST([SRC_DIRS])
434 AC_SUBST([GLU_DIRS])
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])
443
444 dnl
445 dnl User supplied program configuration
446 dnl
447 if test -d "$srcdir/progs/demos"; then
448     default_demos=yes
449 else
450     default_demos=no
451 fi
452 AC_ARG_WITH([demos],
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
459     with_demos=no
460 fi
461
462 dnl If $with_demos is yes, directories will be added as libs available
463 PROGRAM_DIRS=""
464 case "$with_demos" in
465 no) ;;
466 yes)
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"
470     fi
471     ;;
472 *)
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])
478     done
479     PROGRAM_DIRS="$demos"
480     ;;
481 esac
482
483 dnl
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.
486 dnl
487 if test -n "$PKG_CONFIG"; then
488     AC_MSG_CHECKING([pkg-config files for X11 are available])
489     PKG_CHECK_EXISTS([x11],[
490         x11_pkgconfig=yes
491         have_x=yes
492         ],[
493         x11_pkgconfig=no
494     ])
495     AC_MSG_RESULT([$x11_pkgconfig])
496 else
497     x11_pkgconfig=no
498 fi
499 dnl Use the autoconf macro if no pkg-config files
500 if test "$x11_pkgconfig" = no; then
501     AC_PATH_XTRA
502 fi
503
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.])
509
510 dnl We need X for xlib and dri, so bomb now if it's not found
511 case "$mesa_driver" in
512 xlib|dri)
513     if test "$no_x" = yes; then
514         AC_MSG_ERROR([X11 development libraries needed for $mesa_driver driver])
515     fi
516     ;;
517 esac
518
519 dnl XCB - this is only used for GLX right now
520 AC_ARG_ENABLE([xcb],
521     [AS_HELP_STRING([--enable-xcb],
522         [use XCB for GLX @<:@default=disabled@:>@])],
523     [enable_xcb="$enableval"],
524     [enable_xcb=no])
525 if test "x$enable_xcb" = xyes; then
526     DEFINES="$DEFINES -DUSE_XCB"
527 else
528     enable_xcb=no
529 fi
530
531 dnl
532 dnl libGL configuration per driver
533 dnl
534 case "$mesa_driver" in
535 xlib)
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"
541     else
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"
547     fi
548     GL_LIB_DEPS="$GL_LIB_DEPS $SELINUX_LIBS -lm -lpthread"
549     GL_PC_LIB_PRIV="$GL_PC_LIB_PRIV $SELINUX_LIBS -lm -lpthread"
550
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"
555         GL_LIB_DEPS=""
556     fi
557     ;;
558 dri)
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])
562     fi
563
564     # Check for libdrm
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"
569
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"
576         fi
577
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"
582     else
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"
588
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"
595         fi
596     fi
597
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"
601     ;;
602 osmesa)
603     # No libGL for osmesa
604     GL_LIB_DEPS=""
605     ;;
606 esac
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])
612
613 dnl
614 dnl More X11 setup
615 dnl
616 if test "$mesa_driver" = xlib; then
617     DEFINES="$DEFINES -DUSE_XSHM"
618 fi
619
620 dnl
621 dnl More DRI setup
622 dnl
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"],
627     [GLX_USE_TLS=no])
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" @<:@default=auto@:>@])],
646     [with_dri_drivers="$withval"],
647     [with_dri_drivers=yes])
648 if test "x$with_dri_drivers" = x; then
649     with_dri_drivers=no
650 fi
651
652 dnl If $with_dri_drivers is yes, directories will be added through
653 dnl platform checks
654 DRI_DIRS=""
655 case "$with_dri_drivers" in
656 no) ;;
657 yes)
658     DRI_DIRS="yes"
659     ;;
660 *)
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])
666     done
667     DRI_DIRS="$dri_drivers"
668     ;;
669 esac
670
671 dnl Just default to no EGL for now
672 USING_EGL=0
673 AC_SUBST([USING_EGL])
674
675 dnl Set DRI_DIRS, DEFINES and LIB_DEPS
676 if test "$mesa_driver" = dri; then
677     # Use TLS in GLX?
678     if test "x$GLX_USE_TLS" = xyes; then
679         DEFINES="$DEFINES -DGLX_USE_TLS -DPTHREADS"
680     fi
681
682     if test "x$USING_EGL" = x1; then
683         PROGRAM_DIRS="egl"
684     fi
685
686     # Platform specific settings and drivers to build
687     case "$host_os" in
688     linux*)
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"
692         fi
693         DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING -DHAVE_ALIAS"
694
695         case "$host_cpu" in
696         x86_64)
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*
700             # be used.
701             if test "x$DRI_DIRS" = "xyes"; then
702                 DRI_DIRS="i915 i965 mach64 mga r128 r200 r300 radeon \
703                     savage tdfx unichrome swrast"
704             fi
705             ;;
706         powerpc*)
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"
711             fi
712             ;;
713         sparc*)
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"
717             fi
718             ;;
719         esac
720         ;;
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"
727         fi
728         if test "x$GXX" = xyes; then
729             CXXFLAGS="$CXXFLAGS -ansi -pedantic"
730         fi
731
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"
737         fi
738         ;;
739     gnu*)
740         DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
741         DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING -DHAVE_ALIAS"
742         ;;
743     solaris*)
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"
748         fi
749         ;;
750     esac
751
752     # default drivers
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"
756     fi
757
758     DRI_DIRS=`echo "$DRI_DIRS" | $SED 's/  */ /g'`
759
760     # Check for expat
761     EXPAT_INCLUDES=""
762     EXPAT_LIB=-lexpat
763     AC_ARG_WITH([expat],
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"
770         ])
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.])])
774
775     # put all the necessary libs together
776     DRI_LIB_DEPS="$SELINUX_LIBS $LIBDRM_LIBS $EXPAT_LIB -lm -lpthread $DLOPEN_LIBS"
777 fi
778 AC_SUBST([DRI_DIRS])
779 AC_SUBST([EXPAT_INCLUDES])
780 AC_SUBST([DRI_LIB_DEPS])
781
782 dnl
783 dnl OSMesa configuration
784 dnl
785 if test "$mesa_driver" = xlib; then
786     default_gl_osmesa=yes
787 else
788     default_gl_osmesa=no
789 fi
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])
798     else
799         DRIVER_DIRS="$DRIVER_DIRS osmesa"
800     fi
801 fi
802
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"],
808     [osmesa_bits=8])
809 if test "$mesa_driver" != osmesa && test "x$osmesa_bits" != x8; then
810     AC_MSG_WARN([Ignoring OSMesa channel bits for non-OSMesa driver])
811     osmesa_bits=8
812 fi
813 case "x$osmesa_bits" in
814 x8)
815     OSMESA_LIB=OSMesa
816     ;;
817 x16|x32)
818     OSMESA_LIB="OSMesa$osmesa_bits"
819     DEFINES="$DEFINES -DCHAN_BITS=$osmesa_bits -DDEFAULT_SOFTWARE_DEPTH_BITS=31"
820     ;;
821 *)
822     AC_MSG_ERROR([OSMesa bits '$osmesa_bits' is not a valid option])
823     ;;
824 esac
825 AC_SUBST([OSMESA_LIB])
826
827 case "$mesa_driver" in
828 osmesa)
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"
832     else
833         OSMESA_LIB_DEPS=""
834     fi
835     OSMESA_MESA_DEPS=""
836     OSMESA_PC_LIB_PRIV="-lm -lpthread $SELINUX_LIBS $DLOPEN_LIBS"
837     ;;
838 *)
839     # Link OSMesa to libGL otherwise
840     OSMESA_LIB_DEPS=""
841     # only link libraries with osmesa if shared
842     if test "$enable_static" = no; then
843         OSMESA_MESA_DEPS='-l$(GL_LIB)'
844     else
845         OSMESA_MESA_DEPS=""
846     fi
847     OSMESA_PC_REQ="gl"
848     ;;
849 esac
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])
855
856 dnl
857 dnl EGL configuration
858 dnl
859 AC_ARG_ENABLE([egl],
860     [AS_HELP_STRING([--disable-egl],
861         [disable EGL library @<:@default=enabled@:>@])],
862     [enable_egl="$enableval"],
863     [enable_egl=yes])
864 if test "x$enable_egl" = xyes; then
865     SRC_DIRS="$SRC_DIRS egl"
866
867     if test "$x11_pkgconfig" = yes; then
868         PKG_CHECK_MODULES([EGL], [x11])
869         EGL_LIB_DEPS="$EGL_LIBS"
870     else
871         # should check these...
872         EGL_LIB_DEPS="$X_LIBS -lX11"
873     fi
874     EGL_LIB_DEPS="$EGL_LIB_DEPS $DLOPEN_LIBS"
875 fi
876 AC_SUBST([EGL_LIB_DEPS])
877
878 dnl
879 dnl GLU configuration
880 dnl
881 AC_ARG_ENABLE([glu],
882     [AS_HELP_STRING([--disable-glu],
883         [enable OpenGL Utility library @<:@default=enabled@:>@])],
884     [enable_glu="$enableval"],
885     [enable_glu=yes])
886 if test "x$enable_glu" = xyes; then
887     SRC_DIRS="$SRC_DIRS glu"
888
889     case "$mesa_driver" in
890     osmesa)
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"
895         fi
896
897         # Link libGLU to libOSMesa instead of libGL
898         GLU_LIB_DEPS=""
899         GLU_PC_REQ="osmesa"
900         if test "$enable_static" = no; then
901             GLU_MESA_DEPS='-l$(OSMESA_LIB)'
902         else
903             GLU_MESA_DEPS=""
904         fi
905         ;;
906     *)
907         # If static, empty GLU_LIB_DEPS and add libs for programs to link
908         GLU_PC_REQ="gl"
909         GLU_PC_LIB_PRIV="-lm"
910         if test "$enable_static" = no; then
911             GLU_LIB_DEPS="-lm"
912             GLU_MESA_DEPS='-l$(GL_LIB)'
913         else
914             GLU_LIB_DEPS=""
915             GLU_MESA_DEPS=""
916             APP_LIB_DEPS="$APP_LIB_DEPS -lstdc++"
917         fi
918         ;;
919     esac
920 fi
921 if test "$enable_static" = no; then
922     GLU_LIB_DEPS="$GLU_LIB_DEPS $OS_CPLUSPLUS_LIBS"
923 fi
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])
931
932 dnl
933 dnl GLw configuration
934 dnl
935 AC_ARG_ENABLE([glw],
936     [AS_HELP_STRING([--disable-glw],
937         [enable Xt/Motif widget library @<:@default=enabled@:>@])],
938     [enable_glw="$enableval"],
939     [enable_glw=yes])
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])
943     enable_glw=no
944 fi
945 AC_ARG_ENABLE([motif],
946     [AS_HELP_STRING([--enable-motif],
947         [use Motif widgets in GLw @<:@default=disabled@:>@])],
948     [enable_motif="$enableval"],
949     [enable_motif=no])
950
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"
957     else
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"
962     fi
963
964     GLW_SOURCES="GLwDrawA.c"
965     MOTIF_CFLAGS=
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`
972         else
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])])
977         fi
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"
982     fi
983
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"
989     else
990         APP_LIB_DEPS="$APP_LIB_DEPS $GLW_LIB_DEPS"
991         GLW_LIB_DEPS=""
992         GLW_MESA_DEPS=""
993     fi
994 fi
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])
1002
1003 dnl
1004 dnl GLUT configuration
1005 dnl
1006 if test -f "$srcdir/include/GL/glut.h"; then
1007     default_glut=yes
1008 else
1009     default_glut=no
1010 fi
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"])
1016
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])
1020     enable_glut=no
1021 fi
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])
1025     enable_glut=no
1026 fi
1027
1028 if test "x$enable_glut" = xyes; then
1029     SRC_DIRS="$SRC_DIRS glut/glx"
1030     GLUT_CFLAGS=""
1031     if test "x$GCC" = xyes; then
1032         GLUT_CFLAGS="-fexceptions"
1033     fi
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"
1038     else
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"
1043     fi
1044     GLUT_LIB_DEPS="$GLUT_LIB_DEPS -lm"
1045     GLUT_PC_LIB_PRIV="$GLUT_PC_LIB_PRIV -lm"
1046
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"
1050     fi
1051
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)'
1055     else
1056         APP_LIB_DEPS="$APP_LIB_DEPS $GLUT_LIB_DEPS"
1057         GLUT_LIB_DEPS=""
1058         GLUT_MESA_DEPS=""
1059     fi
1060 fi
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])
1067
1068 dnl
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
1072 dnl
1073 if test "x$APP_LIB_DEPS" = x; then
1074     case "$host_os" in
1075     solaris*)
1076         APP_LIB_DEPS="-lX11 -lsocket -lnsl -lm"
1077         ;;
1078     cygwin*)
1079         APP_LIB_DEPS="-lX11"
1080         ;;
1081     *)
1082         APP_LIB_DEPS="-lm"
1083         ;;
1084     esac
1085 fi
1086 AC_SUBST([APP_LIB_DEPS])
1087 AC_SUBST([PROGRAM_DIRS])
1088
1089 dnl
1090 dnl Gallium configuration
1091 dnl
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"
1099 fi
1100
1101 dnl
1102 dnl Gallium state trackers configuration
1103 dnl
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])
1110
1111 case "$with_state_trackers" in
1112 no)
1113     GALLIUM_STATE_TRACKERS_DIRS=""
1114     ;;
1115 yes)
1116     # look at what else is built
1117     case "$mesa_driver" in
1118     xlib)
1119         GALLIUM_STATE_TRACKERS_DIRS=glx
1120         ;;
1121     dri)
1122         test "x$enable_egl" = xyes && GALLIUM_STATE_TRACKERS_DIRS=egl
1123         ;;
1124     esac
1125     ;;
1126 *)
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])
1132
1133         if test "$tracker" = egl && test "x$enable_egl" != xyes; then
1134             AC_MSG_ERROR([cannot build egl state tracker without EGL library])
1135         fi
1136     done
1137     GALLIUM_STATE_TRACKERS_DIRS="$state_trackers"
1138     ;;
1139 esac
1140
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])
1147
1148 AC_ARG_WITH([max-width],
1149     [AS_HELP_STRING([--with-max-width=N],
1150                     [Maximum framebuffer width (4096)])],
1151     [DEFINES="${DEFINES} -DMAX_WIDTH=${withval}";
1152      AS_IF([test "${withval}" -gt "4096"],
1153            [AC_MSG_WARN([Large framebuffer: see s_tritemp.h comments.])])]
1154 )
1155 AC_ARG_WITH([max-height],
1156     [AS_HELP_STRING([--with-max-height=N],
1157                     [Maximum framebuffer height (4096)])],
1158     [DEFINES="${DEFINES} -DMAX_HEIGHT=${withval}";
1159      AS_IF([test "${withval}" -gt "4096"],
1160            [AC_MSG_WARN([Large framebuffer: see s_tritemp.h comments.])])]
1161 )
1162
1163 dnl
1164 dnl Gallium Intel configuration
1165 dnl
1166 AC_ARG_ENABLE([gallium-intel],
1167     [AS_HELP_STRING([--disable-gallium-intel],
1168         [build gallium intel @<:@default=enabled@:>@])],
1169     [enable_gallium_intel="$enableval"],
1170     [enable_gallium_intel=yes])
1171 if test "x$enable_gallium_intel" = xyes; then
1172     GALLIUM_WINSYS_DRM_DIRS="$GALLIUM_WINSYS_DRM_DIRS intel"
1173     GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS i915simple"
1174 fi
1175
1176 dnl
1177 dnl Gallium Radeon configuration
1178 dnl
1179 AC_ARG_ENABLE([gallium-radeon],
1180     [AS_HELP_STRING([--enable-gallium-radeon],
1181         [build gallium radeon @<:@default=disabled@:>@])],
1182     [enable_gallium_radeon="$enableval"],
1183     [enable_gallium_radeon=no])
1184 if test "x$enable_gallium_radeon" = xyes; then
1185     GALLIUM_WINSYS_DRM_DIRS="$GALLIUM_WINSYS_DRM_DIRS radeon"
1186     GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r300"
1187 fi
1188
1189 dnl
1190 dnl Gallium Radeon configuration
1191 dnl
1192 AC_ARG_ENABLE([gallium-nouveau],
1193     [AS_HELP_STRING([--enable-gallium-nouveau],
1194         [build gallium nouveau @<:@default=disabled@:>@])],
1195     [enable_gallium_nouveau="$enableval"],
1196     [enable_gallium_nouveau=no])
1197 if test "x$enable_gallium_nouveau" = xyes; then
1198     GALLIUM_WINSYS_DRM_DIRS="$GALLIUM_WINSYS_DRM_DIRS nouveau"
1199     GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS nv04 nv10 nv20 nv30 nv40 nv50"
1200 fi
1201
1202
1203 dnl Restore LDFLAGS and CPPFLAGS
1204 LDFLAGS="$_SAVE_LDFLAGS"
1205 CPPFLAGS="$_SAVE_CPPFLAGS"
1206
1207 dnl Substitute the config
1208 AC_CONFIG_FILES([configs/autoconf])
1209
1210 dnl Replace the configs/current symlink
1211 AC_CONFIG_COMMANDS([configs],[
1212 if test -f configs/current || test -L configs/current; then
1213     rm -f configs/current
1214 fi
1215 ln -s autoconf configs/current
1216 ])
1217
1218 AC_OUTPUT
1219
1220 dnl
1221 dnl Output some configuration info for the user
1222 dnl
1223 echo ""
1224 echo "        prefix:          $prefix"
1225 echo "        exec_prefix:     $exec_prefix"
1226 echo "        libdir:          $libdir"
1227 echo "        includedir:      $includedir"
1228
1229 dnl Driver info
1230 echo ""
1231 echo "        Driver:          $mesa_driver"
1232 if echo "$DRIVER_DIRS" | grep 'osmesa' >/dev/null 2>&1; then
1233     echo "        OSMesa:          lib$OSMESA_LIB"
1234 else
1235     echo "        OSMesa:          no"
1236 fi
1237 if test "$mesa_driver" = dri; then
1238     # cleanup the drivers var
1239     dri_dirs=`echo $DRI_DIRS | $SED 's/^ *//;s/  */ /;s/ *$//'`
1240 if test "x$DRI_DIRS" = x; then
1241     echo "        DRI drivers:     no"
1242 else
1243     echo "        DRI drivers:     $dri_dirs"
1244 fi
1245     echo "        DRI driver dir:  $DRI_DRIVER_INSTALL_DIR"
1246 fi
1247 echo "        Use XCB:         $enable_xcb"
1248
1249 echo ""
1250 if echo "$SRC_DIRS" | grep 'gallium' >/dev/null 2>&1; then
1251     echo "        Gallium:         yes"
1252     echo "        Gallium dirs:    $GALLIUM_DIRS"
1253     echo "        Winsys dirs:     $GALLIUM_WINSYS_DIRS"
1254     echo "        Winsys drm dirs:$GALLIUM_WINSYS_DRM_DIRS"
1255     echo "        Auxiliary dirs:  $GALLIUM_AUXILIARY_DIRS"
1256     echo "        Driver dirs:     $GALLIUM_DRIVERS_DIRS"
1257     echo "        Trackers dirs:   $GALLIUM_STATE_TRACKERS_DIRS"
1258 else
1259     echo "        Gallium:         no"
1260 fi
1261
1262 dnl Libraries
1263 echo ""
1264 echo "        Shared libs:     $enable_shared"
1265 echo "        Static libs:     $enable_static"
1266 echo "        EGL:             $enable_egl"
1267 echo "        GLU:             $enable_glu"
1268 echo "        GLw:             $enable_glw (Motif: $enable_motif)"
1269 echo "        glut:            $enable_glut"
1270
1271 dnl Programs
1272 # cleanup the programs var for display
1273 program_dirs=`echo $PROGRAM_DIRS | $SED 's/^ *//;s/  */ /;s/ *$//'`
1274 if test "x$program_dirs" = x; then
1275     echo "        Demos:           no"
1276 else
1277     echo "        Demos:           $program_dirs"
1278 fi
1279
1280 dnl Compiler options
1281 # cleanup the CFLAGS/CXXFLAGS/DEFINES vars
1282 cflags=`echo $CFLAGS $OPT_FLAGS $PIC_FLAGS $ARCH_FLAGS | \
1283     $SED 's/^ *//;s/  */ /;s/ *$//'`
1284 cxxflags=`echo $CXXFLAGS $OPT_FLAGS $PIC_FLAGS $ARCH_FLAGS | \
1285     $SED 's/^ *//;s/  */ /;s/ *$//'`
1286 defines=`echo $DEFINES $ASM_FLAGS | $SED 's/^ *//;s/  */ /;s/ *$//'`
1287 echo ""
1288 echo "        CFLAGS:          $cflags"
1289 echo "        CXXFLAGS:        $cxxflags"
1290 echo "        Macros:          $defines"
1291
1292 echo ""
1293 echo "        Run '${MAKE-make}' to build Mesa"
1294 echo ""