Make configure work with clang
[profile/ivi/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' | tr -d '\r'])])
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.15
22 LIBDRM_RADEON_REQUIRED=2.4.17
23 DRI2PROTO_REQUIRED=2.1
24 GLPROTO_REQUIRED=1.4.11
25 LIBDRM_XORG_REQUIRED=2.4.17
26 LIBKMS_XORG_REQUIRED=1.0.0
27
28 dnl Check for progs
29 AC_PROG_CPP
30 AC_PROG_CC
31 AC_PROG_CXX
32 AC_CHECK_PROGS([MAKE], [gmake make])
33 AC_PATH_PROG([MKDEP], [makedepend])
34 AC_PATH_PROG([SED], [sed])
35
36 dnl Our fallback install-sh is a symlink to minstall. Use the existing
37 dnl configuration in that case.
38 AC_PROG_INSTALL
39 test "x$INSTALL" = "x$ac_install_sh" && INSTALL='$(MINSTALL)'
40
41 dnl We need a POSIX shell for parts of the build. Assume we have one
42 dnl in most cases.
43 case "$host_os" in
44 solaris*)
45     # Solaris /bin/sh is too old/non-POSIX compliant
46     AC_PATH_PROGS(POSIX_SHELL, [ksh93 ksh sh])
47     SHELL="$POSIX_SHELL"
48     ;;
49 esac
50
51 dnl clang is mostly GCC-compatible, but its version is much lower,
52 dnl so we have to check for it.
53 AC_MSG_CHECKING([if compiling with clang])
54
55 AC_COMPILE_IFELSE(
56 [AC_LANG_PROGRAM([], [[
57 #ifndef __clang__
58        not clang
59 #endif
60 ]])],
61 [CLANG=yes], [CLANG=no])
62
63 AC_MSG_RESULT([$CLANG])
64
65 dnl If we're using GCC, make sure that it is at least version 3.3.0.  Older
66 dnl versions are explictly not supported.
67 if test "x$GCC" = xyes -a "x$CLANG" = xno; then
68     AC_MSG_CHECKING([whether gcc version is sufficient])
69     major=0
70     minor=0
71
72     GCC_VERSION=`$CC -dumpversion`
73     if test $? -eq 0; then
74         major=`echo $GCC_VERSION | cut -d. -f1`
75         minor=`echo $GCC_VERSION | cut -d. -f1`
76     fi
77
78     if test $major -lt 3 -o $major -eq 3 -a $minor -lt 3 ; then
79         AC_MSG_RESULT([no])
80         AC_MSG_ERROR([If using GCC, version 3.3.0 or later is required.])
81     else
82         AC_MSG_RESULT([yes])
83     fi
84 fi
85
86
87 MKDEP_OPTIONS=-fdepend
88 dnl Ask gcc where it's keeping its secret headers
89 if test "x$GCC" = xyes; then
90     for dir in include include-fixed; do
91         GCC_INCLUDES=`$CC -print-file-name=$dir`
92         if test "x$GCC_INCLUDES" != x && \
93            test "$GCC_INCLUDES" != "$dir" && \
94            test -d "$GCC_INCLUDES"; then
95             MKDEP_OPTIONS="$MKDEP_OPTIONS -I$GCC_INCLUDES"
96         fi
97     done
98 fi
99 AC_SUBST([MKDEP_OPTIONS])
100
101 dnl Make sure the pkg-config macros are defined
102 m4_ifndef([PKG_PROG_PKG_CONFIG],
103     [m4_fatal([Could not locate the pkg-config autoconf macros.
104   These are usually located in /usr/share/aclocal/pkg.m4. If your macros
105   are in a different location, try setting the environment variable
106   ACLOCAL="aclocal -I/other/macro/dir" before running autoreconf.])])
107 PKG_PROG_PKG_CONFIG()
108
109 dnl LIB_DIR - library basename
110 LIB_DIR=`echo $libdir | $SED 's%.*/%%'`
111 AC_SUBST([LIB_DIR])
112
113 dnl Cache LDFLAGS so we can add EXTRA_LIB_PATH and restore it later
114 _SAVE_LDFLAGS="$LDFLAGS"
115 AC_ARG_VAR([EXTRA_LIB_PATH],[Extra -L paths for the linker])
116 AC_SUBST([EXTRA_LIB_PATH])
117
118 dnl Cache CPPFLAGS so we can add *_INCLUDES and restore it later
119 _SAVE_CPPFLAGS="$CPPFLAGS"
120 AC_ARG_VAR([X11_INCLUDES],[Extra -I paths for X11 headers])
121 AC_SUBST([X11_INCLUDES])
122
123 dnl Compiler macros
124 DEFINES=""
125 AC_SUBST([DEFINES])
126 case "$host_os" in
127 linux*|*-gnu*|gnu*)
128     DEFINES="$DEFINES -D_GNU_SOURCE -DPTHREADS"
129     ;;
130 solaris*)
131     DEFINES="$DEFINES -DPTHREADS -DSVR4"
132     ;;
133 cygwin*)
134     DEFINES="$DEFINES -DPTHREADS"
135     ;;
136 esac
137
138 dnl Add flags for gcc and g++
139 if test "x$GCC" = xyes; then
140     CFLAGS="$CFLAGS -Wall -Wmissing-prototypes -std=c99 -ffast-math"
141
142     # Enable -fvisibility=hidden if using a gcc that supports it
143     save_CFLAGS="$CFLAGS"
144     AC_MSG_CHECKING([whether $CC supports -fvisibility=hidden])
145     CFLAGS="$CFLAGS -fvisibility=hidden"
146     AC_LINK_IFELSE([AC_LANG_PROGRAM()], AC_MSG_RESULT([yes]),
147                    [CFLAGS="$save_CFLAGS" ; AC_MSG_RESULT([no])]);
148
149     # Work around aliasing bugs - developers should comment this out
150     CFLAGS="$CFLAGS -fno-strict-aliasing"
151 fi
152 if test "x$GXX" = xyes; then
153     CXXFLAGS="$CXXFLAGS -Wall"
154
155     # Work around aliasing bugs - developers should comment this out
156     CXXFLAGS="$CXXFLAGS -fno-strict-aliasing"
157 fi
158
159 dnl These should be unnecessary, but let the user set them if they want
160 AC_ARG_VAR([OPT_FLAGS], [Additional optimization flags for the compiler.
161     Default is to use CFLAGS.])
162 AC_ARG_VAR([ARCH_FLAGS], [Additional architecture specific flags for the
163     compiler. Default is to use CFLAGS.])
164 AC_SUBST([OPT_FLAGS])
165 AC_SUBST([ARCH_FLAGS])
166
167 dnl
168 dnl Hacks to enable 32 or 64 bit build
169 dnl
170 AC_ARG_ENABLE([32-bit],
171     [AS_HELP_STRING([--enable-32-bit],
172         [build 32-bit libraries @<:@default=auto@:>@])],
173     [enable_32bit="$enableval"],
174     [enable_32bit=auto]
175 )
176 if test "x$enable_32bit" = xyes; then
177     if test "x$GCC" = xyes; then
178         CFLAGS="$CFLAGS -m32"
179         ARCH_FLAGS="$ARCH_FLAGS -m32"
180     fi
181     if test "x$GXX" = xyes; then
182         CXXFLAGS="$CXXFLAGS -m32"
183     fi
184 fi
185 AC_ARG_ENABLE([64-bit],
186     [AS_HELP_STRING([--enable-64-bit],
187         [build 64-bit libraries @<:@default=auto@:>@])],
188     [enable_64bit="$enableval"],
189     [enable_64bit=auto]
190 )
191 if test "x$enable_64bit" = xyes; then
192     if test "x$GCC" = xyes; then
193         CFLAGS="$CFLAGS -m64"
194     fi
195     if test "x$GXX" = xyes; then
196         CXXFLAGS="$CXXFLAGS -m64"
197     fi
198 fi
199
200 dnl
201 dnl shared/static libraries, mimic libtool options
202 dnl
203 AC_ARG_ENABLE([static],
204     [AS_HELP_STRING([--enable-static],
205         [build static libraries @<:@default=disabled@:>@])],
206     [enable_static="$enableval"],
207     [enable_static=no]
208 )
209 case "x$enable_static" in
210 xyes|xno ) ;;
211 x ) enable_static=no ;;
212 * )
213     AC_MSG_ERROR([Static library option '$enable_static' is not a valid])
214     ;;
215 esac
216 AC_ARG_ENABLE([shared],
217     [AS_HELP_STRING([--disable-shared],
218         [build shared libraries @<:@default=enabled@:>@])],
219     [enable_shared="$enableval"],
220     [enable_shared=yes]
221 )
222 case "x$enable_shared" in
223 xyes|xno ) ;;
224 x ) enable_shared=yes ;;
225 * )
226     AC_MSG_ERROR([Shared library option '$enable_shared' is not a valid])
227     ;;
228 esac
229
230 dnl Can't have static and shared libraries, default to static if user
231 dnl explicitly requested. If both disabled, set to static since shared
232 dnl was explicitly requirested.
233 case "x$enable_static$enable_shared" in
234 xyesyes )
235     AC_MSG_WARN([Can't build static and shared libraries, disabling shared])
236     enable_shared=no
237     ;;
238 xnono )
239     AC_MSG_WARN([Can't disable both static and shared libraries, enabling static])
240     enable_static=yes
241     ;;
242 esac
243
244 dnl
245 dnl mklib options
246 dnl
247 AC_ARG_VAR([MKLIB_OPTIONS],[Options for the Mesa library script, mklib])
248 if test "$enable_static" = yes; then
249     MKLIB_OPTIONS="$MKLIB_OPTIONS -static"
250 fi
251 AC_SUBST([MKLIB_OPTIONS])
252
253 dnl
254 dnl other compiler options
255 dnl
256 AC_ARG_ENABLE([debug],
257     [AS_HELP_STRING([--enable-debug],
258         [use debug compiler flags and macros @<:@default=disabled@:>@])],
259     [enable_debug="$enableval"],
260     [enable_debug=no]
261 )
262 if test "x$enable_debug" = xyes; then
263     DEFINES="$DEFINES -DDEBUG"
264     if test "x$GCC" = xyes; then
265         CFLAGS="$CFLAGS -g"
266     fi
267     if test "x$GXX" = xyes; then
268         CXXFLAGS="$CXXFLAGS -g"
269     fi
270 fi
271
272 dnl
273 dnl library names
274 dnl
275 if test "$enable_static" = yes; then
276     LIB_EXTENSION='a'
277 else
278     case "$host_os" in
279     darwin* )
280         LIB_EXTENSION='dylib' ;;
281     cygwin* )
282         LIB_EXTENSION='dll.a' ;;
283     aix* )
284         LIB_EXTENSION='a' ;;
285     * )
286         LIB_EXTENSION='so' ;;
287     esac
288 fi
289
290 GL_LIB_NAME='lib$(GL_LIB).'${LIB_EXTENSION}
291 GLU_LIB_NAME='lib$(GLU_LIB).'${LIB_EXTENSION}
292 GLUT_LIB_NAME='lib$(GLUT_LIB).'${LIB_EXTENSION}
293 GLW_LIB_NAME='lib$(GLW_LIB).'${LIB_EXTENSION}
294 OSMESA_LIB_NAME='lib$(OSMESA_LIB).'${LIB_EXTENSION}
295 EGL_LIB_NAME='lib$(EGL_LIB).'${LIB_EXTENSION}
296 GLESv1_CM_LIB_NAME='lib$(GLESv1_CM_LIB).'${LIB_EXTENSION}
297 GLESv2_LIB_NAME='lib$(GLESv2_LIB).'${LIB_EXTENSION}
298 VG_LIB_NAME='lib$(VG_LIB).'${LIB_EXTENSION}
299
300 GL_LIB_GLOB='lib$(GL_LIB).*'${LIB_EXTENSION}'*'
301 GLU_LIB_GLOB='lib$(GLU_LIB).*'${LIB_EXTENSION}'*'
302 GLUT_LIB_GLOB='lib$(GLUT_LIB).*'${LIB_EXTENSION}'*'
303 GLW_LIB_GLOB='lib$(GLW_LIB).*'${LIB_EXTENSION}'*'
304 OSMESA_LIB_GLOB='lib$(OSMESA_LIB).*'${LIB_EXTENSION}'*'
305 EGL_LIB_GLOB='lib$(EGL_LIB).*'${LIB_EXTENSION}'*'
306 GLESv1_CM_LIB_GLOB='lib$(GLESv1_CM_LIB).*'${LIB_EXTENSION}'*'
307 GLESv2_LIB_GLOB='lib$(GLESv2_LIB).*'${LIB_EXTENSION}'*'
308 VG_LIB_GLOB='lib$(VG_LIB).*'${LIB_EXTENSION}'*'
309
310 AC_SUBST([GL_LIB_NAME])
311 AC_SUBST([GLU_LIB_NAME])
312 AC_SUBST([GLUT_LIB_NAME])
313 AC_SUBST([GLW_LIB_NAME])
314 AC_SUBST([OSMESA_LIB_NAME])
315 AC_SUBST([EGL_LIB_NAME])
316 AC_SUBST([GLESv1_CM_LIB_NAME])
317 AC_SUBST([GLESv2_LIB_NAME])
318 AC_SUBST([VG_LIB_NAME])
319
320 AC_SUBST([GL_LIB_GLOB])
321 AC_SUBST([GLU_LIB_GLOB])
322 AC_SUBST([GLUT_LIB_GLOB])
323 AC_SUBST([GLW_LIB_GLOB])
324 AC_SUBST([OSMESA_LIB_GLOB])
325 AC_SUBST([EGL_LIB_GLOB])
326 AC_SUBST([GLESv1_CM_LIB_GLOB])
327 AC_SUBST([GLESv2_LIB_GLOB])
328 AC_SUBST([VG_LIB_GLOB])
329
330 dnl
331 dnl Arch/platform-specific settings
332 dnl
333 AC_ARG_ENABLE([asm],
334     [AS_HELP_STRING([--disable-asm],
335         [disable assembly usage @<:@default=enabled on supported plaforms@:>@])],
336     [enable_asm="$enableval"],
337     [enable_asm=yes]
338 )
339 asm_arch=""
340 ASM_FLAGS=""
341 MESA_ASM_SOURCES=""
342 GLAPI_ASM_SOURCES=""
343 AC_MSG_CHECKING([whether to enable assembly])
344 test "x$enable_asm" = xno && AC_MSG_RESULT([no])
345 # disable if cross compiling on x86/x86_64 since we must run gen_matypes
346 if test "x$enable_asm" = xyes && test "x$cross_compiling" = xyes; then
347     case "$host_cpu" in
348     i?86 | x86_64)
349         enable_asm=no
350         AC_MSG_RESULT([no, cross compiling])
351         ;;
352     esac
353 fi
354 # check for supported arches
355 if test "x$enable_asm" = xyes; then
356     case "$host_cpu" in
357     i?86)
358         case "$host_os" in
359         linux* | *freebsd* | dragonfly*)
360             test "x$enable_64bit" = xyes && asm_arch=x86_64 || asm_arch=x86
361             ;;
362         esac
363         ;;
364     x86_64)
365         case "$host_os" in
366         linux* | *freebsd* | dragonfly*)
367             test "x$enable_32bit" = xyes && asm_arch=x86 || asm_arch=x86_64
368             ;;
369         esac
370         ;;
371     powerpc)
372         case "$host_os" in
373         linux*)
374             asm_arch=ppc
375             ;;
376         esac
377         ;;
378     sparc*)
379         case "$host_os" in
380         linux*)
381             asm_arch=sparc
382             ;;
383         esac
384         ;;
385     esac
386
387     case "$asm_arch" in
388     x86)
389         ASM_FLAGS="-DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM"
390         MESA_ASM_SOURCES='$(X86_SOURCES)'
391         GLAPI_ASM_SOURCES='$(X86_API)'
392         AC_MSG_RESULT([yes, x86])
393         ;;
394     x86_64)
395         ASM_FLAGS="-DUSE_X86_64_ASM"
396         MESA_ASM_SOURCES='$(X86-64_SOURCES)'
397         GLAPI_ASM_SOURCES='$(X86-64_API)'
398         AC_MSG_RESULT([yes, x86_64])
399         ;;
400     ppc)
401         ASM_FLAGS="-DUSE_PPC_ASM -DUSE_VMX_ASM"
402         MESA_ASM_SOURCES='$(PPC_SOURCES)'
403         AC_MSG_RESULT([yes, ppc])
404         ;;
405     sparc)
406         ASM_FLAGS="-DUSE_SPARC_ASM"
407         MESA_ASM_SOURCES='$(SPARC_SOURCES)'
408         GLAPI_ASM_SOURCES='$(SPARC_API)'
409         AC_MSG_RESULT([yes, sparc])
410         ;;
411     *)
412         AC_MSG_RESULT([no, platform not supported])
413         ;;
414     esac
415 fi
416 AC_SUBST([ASM_FLAGS])
417 AC_SUBST([MESA_ASM_SOURCES])
418 AC_SUBST([GLAPI_ASM_SOURCES])
419
420 dnl PIC code macro
421 MESA_PIC_FLAGS
422
423 dnl Check to see if dlopen is in default libraries (like Solaris, which
424 dnl has it in libc), or if libdl is needed to get it.
425 AC_CHECK_FUNC([dlopen], [],
426     [AC_CHECK_LIB([dl], [dlopen], [DLOPEN_LIBS="-ldl"])])
427 AC_SUBST([DLOPEN_LIBS])
428
429 dnl See if posix_memalign is available
430 AC_CHECK_FUNC([posix_memalign], [DEFINES="$DEFINES -DHAVE_POSIX_MEMALIGN"])
431
432 dnl SELinux awareness.
433 AC_ARG_ENABLE([selinux],
434     [AS_HELP_STRING([--enable-selinux],
435         [Build SELinux-aware Mesa @<:@default=disabled@:>@])],
436     [MESA_SELINUX="$enableval"],
437     [MESA_SELINUX=no])
438 if test "x$enable_selinux" = "xyes"; then
439     AC_CHECK_HEADER([selinux/selinux.h],[],
440                     [AC_MSG_ERROR([SELinux headers not found])])
441     AC_CHECK_LIB([selinux],[is_selinux_enabled],[],
442                  [AC_MSG_ERROR([SELinux library not found])])
443     SELINUX_LIBS="-lselinux"
444     DEFINES="$DEFINES -DMESA_SELINUX"
445 fi
446
447 dnl
448 dnl Driver configuration. Options are xlib, dri and osmesa right now.
449 dnl More later: fbdev, ...
450 dnl
451 default_driver="xlib"
452
453 case "$host_os" in
454 linux*)
455     case "$host_cpu" in
456     i*86|x86_64|powerpc*|sparc*) default_driver="dri";;
457     esac
458     ;;
459 *freebsd* | dragonfly*)
460     case "$host_cpu" in
461     i*86|x86_64|powerpc*|sparc*) default_driver="dri";;
462     esac
463     ;;
464 esac
465
466 AC_ARG_WITH([driver],
467     [AS_HELP_STRING([--with-driver=DRIVER],
468         [driver for Mesa: xlib,dri,osmesa @<:@default=dri when available, or xlib@:>@])],
469     [mesa_driver="$withval"],
470     [mesa_driver="$default_driver"])
471 dnl Check for valid option
472 case "x$mesa_driver" in
473 xxlib|xdri|xosmesa)
474     ;;
475 *)
476     AC_MSG_ERROR([Driver '$mesa_driver' is not a valid option])
477     ;;
478 esac
479
480 PKG_CHECK_MODULES([TALLOC], [talloc])
481 AC_SUBST([TALLOC_LIBS])
482 AC_SUBST([TALLOC_CFLAGS])
483
484 dnl
485 dnl Driver specific build directories
486 dnl
487
488 dnl this variable will be prepended to SRC_DIRS and is not exported
489 CORE_DIRS="mapi/glapi glsl mesa"
490
491 SRC_DIRS=""
492 GLU_DIRS="sgi"
493 GALLIUM_DIRS="auxiliary drivers state_trackers"
494 GALLIUM_TARGET_DIRS=""
495 GALLIUM_WINSYS_DIRS="sw"
496 GALLIUM_DRIVERS_DIRS="softpipe failover galahad trace rbug identity"
497 GALLIUM_STATE_TRACKERS_DIRS=""
498
499 case "$mesa_driver" in
500 xlib)
501     DRIVER_DIRS="x11"
502     GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS sw/xlib"
503     GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS libgl-xlib"
504     ;;
505 dri)
506     SRC_DIRS="$SRC_DIRS glx"
507     DRIVER_DIRS="dri"
508     GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS sw/xlib sw/dri"
509     ;;
510 osmesa)
511     DRIVER_DIRS="osmesa"
512     ;;
513 esac
514 AC_SUBST([SRC_DIRS])
515 AC_SUBST([GLU_DIRS])
516 AC_SUBST([DRIVER_DIRS])
517 AC_SUBST([GALLIUM_DIRS])
518 AC_SUBST([GALLIUM_TARGET_DIRS])
519 AC_SUBST([GALLIUM_WINSYS_DIRS])
520 AC_SUBST([GALLIUM_DRIVERS_DIRS])
521 AC_SUBST([GALLIUM_STATE_TRACKERS_DIRS])
522 AC_SUBST([MESA_LLVM])
523
524 dnl
525 dnl Find out if X is available. The variable have_x is set if libX11 is
526 dnl found to mimic AC_PATH_XTRA.
527 dnl
528 if test -n "$PKG_CONFIG"; then
529     AC_MSG_CHECKING([pkg-config files for X11 are available])
530     PKG_CHECK_EXISTS([x11],[
531         x11_pkgconfig=yes
532         have_x=yes
533         ],[
534         x11_pkgconfig=no
535     ])
536     AC_MSG_RESULT([$x11_pkgconfig])
537 else
538     x11_pkgconfig=no
539 fi
540 dnl Use the autoconf macro if no pkg-config files
541 if test "$x11_pkgconfig" = yes; then
542     PKG_CHECK_MODULES([X11], [x11])
543 else
544     AC_PATH_XTRA
545     test -z "$X11_CFLAGS" && X11_CFLAGS="$X_CFLAGS"
546     test -z "$X11_LIBS" && X11_LIBS="$X_LIBS -lX11"
547     AC_SUBST([X11_CFLAGS])
548     AC_SUBST([X11_LIBS])
549 fi
550
551 dnl Try to tell the user that the --x-* options are only used when
552 dnl pkg-config is not available. This must be right after AC_PATH_XTRA.
553 m4_divert_once([HELP_BEGIN],
554 [These options are only used when the X libraries cannot be found by the
555 pkg-config utility.])
556
557 dnl We need X for xlib and dri, so bomb now if it's not found
558 case "$mesa_driver" in
559 xlib|dri)
560     if test "$no_x" = yes; then
561         AC_MSG_ERROR([X11 development libraries needed for $mesa_driver driver])
562     fi
563     ;;
564 esac
565
566 dnl XCB - this is only used for GLX right now
567 AC_ARG_ENABLE([xcb],
568     [AS_HELP_STRING([--enable-xcb],
569         [use XCB for GLX @<:@default=disabled@:>@])],
570     [enable_xcb="$enableval"],
571     [enable_xcb=no])
572 if test "x$enable_xcb" = xyes; then
573     DEFINES="$DEFINES -DUSE_XCB"
574 else
575     enable_xcb=no
576 fi
577
578 dnl
579 dnl libGL configuration per driver
580 dnl
581 case "$mesa_driver" in
582 xlib)
583     if test "$x11_pkgconfig" = yes; then
584         PKG_CHECK_MODULES([XLIBGL], [x11 xext])
585         GL_PC_REQ_PRIV="x11 xext"
586         X11_INCLUDES="$X11_INCLUDES $XLIBGL_CFLAGS"
587         GL_LIB_DEPS="$XLIBGL_LIBS"
588     else
589         # should check these...
590         X11_INCLUDES="$X11_INCLUDES $X_CFLAGS"
591         GL_LIB_DEPS="$X_LIBS -lX11 -lXext"
592         GL_PC_LIB_PRIV="$GL_LIB_DEPS"
593         GL_PC_CFLAGS="$X11_INCLUDES"
594     fi
595     GL_LIB_DEPS="$GL_LIB_DEPS $SELINUX_LIBS -lm -lpthread $TALLOC_LIBS"
596     GL_PC_LIB_PRIV="$GL_PC_LIB_PRIV $SELINUX_LIBS -lm -lpthread $TALLOC_LIBS"
597
598     # if static, move the external libraries to the programs
599     # and empty the libraries for libGL
600     if test "$enable_static" = yes; then
601         APP_LIB_DEPS="$APP_LIB_DEPS $GL_LIB_DEPS"
602         GL_LIB_DEPS=""
603     fi
604     ;;
605 dri)
606     # DRI must be shared, I think
607     if test "$enable_static" = yes; then
608         AC_MSG_ERROR([Can't use static libraries for DRI drivers])
609     fi
610
611     # Check for libdrm
612     PKG_CHECK_MODULES([LIBDRM], [libdrm >= $LIBDRM_REQUIRED])
613     PKG_CHECK_MODULES([DRI2PROTO], [dri2proto >= $DRI2PROTO_REQUIRED])
614     PKG_CHECK_MODULES([GLPROTO], [glproto >= $GLPROTO_REQUIRED])
615     GL_PC_REQ_PRIV="libdrm >= $LIBDRM_REQUIRED dri2proto >= $DRI2PROTO_REQUIRED glproto >= $GLPROTO_REQUIRED"
616     DRI_PC_REQ_PRIV="libdrm >= $LIBDRM_REQUIRED"
617
618     # find the DRI deps for libGL
619     if test "$x11_pkgconfig" = yes; then
620         # add xcb modules if necessary
621         dri_modules="x11 xext xxf86vm xdamage xfixes"
622         if test "$enable_xcb" = yes; then
623             dri_modules="$dri_modules x11-xcb xcb-glx"
624         fi
625
626         PKG_CHECK_MODULES([DRIGL], [$dri_modules])
627         GL_PC_REQ_PRIV="$GL_PC_REQ_PRIV $dri_modules"
628         X11_INCLUDES="$X11_INCLUDES $DRIGL_CFLAGS"
629         GL_LIB_DEPS="$DRIGL_LIBS"
630     else
631         # should check these...
632         X11_INCLUDES="$X11_INCLUDES $X_CFLAGS"
633         GL_LIB_DEPS="$X_LIBS -lX11 -lXext -lXxf86vm -lXdamage -lXfixes"
634         GL_PC_LIB_PRIV="$GL_LIB_DEPS"
635         GL_PC_CFLAGS="$X11_INCLUDES"
636
637         # XCB can only be used from pkg-config
638         if test "$enable_xcb" = yes; then
639             PKG_CHECK_MODULES([XCB],[x11-xcb xcb-glx])
640             GL_PC_REQ_PRIV="$GL_PC_REQ_PRIV x11-xcb xcb-glx"
641             X11_INCLUDES="$X11_INCLUDES $XCB_CFLAGS"
642             GL_LIB_DEPS="$GL_LIB_DEPS $XCB_LIBS"
643         fi
644     fi
645
646     # need DRM libs, -lpthread, etc.
647     GL_LIB_DEPS="$GL_LIB_DEPS $LIBDRM_LIBS -lm -lpthread $DLOPEN_LIBS"
648     GL_PC_LIB_PRIV="-lm -lpthread $DLOPEN_LIBS"
649     GLESv1_CM_LIB_DEPS="$LIBDRM_LIBS -lm -lpthread $DLOPEN_LIBS"
650     GLESv1_CM_PC_LIB_PRIV="-lm -lpthread $DLOPEN_LIBS"
651     GLESv2_LIB_DEPS="$LIBDRM_LIBS -lm -lpthread $DLOPEN_LIBS"
652     GLESv2_PC_LIB_PRIV="-lm -lpthread $DLOPEN_LIBS"
653     ;;
654 osmesa)
655     # No libGL for osmesa
656     GL_LIB_DEPS=""
657     ;;
658 esac
659 AC_SUBST([GL_LIB_DEPS])
660 AC_SUBST([GL_PC_REQ_PRIV])
661 AC_SUBST([GL_PC_LIB_PRIV])
662 AC_SUBST([GL_PC_CFLAGS])
663 AC_SUBST([DRI_PC_REQ_PRIV])
664 AC_SUBST([GLESv1_CM_LIB_DEPS])
665 AC_SUBST([GLESv1_CM_PC_LIB_PRIV])
666 AC_SUBST([GLESv2_LIB_DEPS])
667 AC_SUBST([GLESv2_PC_LIB_PRIV])
668
669
670 dnl
671 dnl More X11 setup
672 dnl
673 if test "$mesa_driver" = xlib; then
674     DEFINES="$DEFINES -DUSE_XSHM"
675 fi
676
677 dnl
678 dnl More DRI setup
679 dnl
680 AC_ARG_ENABLE([glx-tls],
681     [AS_HELP_STRING([--enable-glx-tls],
682         [enable TLS support in GLX @<:@default=disabled@:>@])],
683     [GLX_USE_TLS="$enableval"],
684     [GLX_USE_TLS=no])
685 dnl Directory for DRI drivers
686 AC_ARG_WITH([dri-driverdir],
687     [AS_HELP_STRING([--with-dri-driverdir=DIR],
688         [directory for the DRI drivers @<:@${libdir}/dri@:>@])],
689     [DRI_DRIVER_INSTALL_DIR="$withval"],
690     [DRI_DRIVER_INSTALL_DIR='${libdir}/dri'])
691 AC_SUBST([DRI_DRIVER_INSTALL_DIR])
692 dnl Extra search path for DRI drivers
693 AC_ARG_WITH([dri-searchpath],
694     [AS_HELP_STRING([--with-dri-searchpath=DIRS...],
695         [semicolon delimited DRI driver search directories @<:@${libdir}/dri@:>@])],
696     [DRI_DRIVER_SEARCH_DIR="$withval"],
697     [DRI_DRIVER_SEARCH_DIR='${DRI_DRIVER_INSTALL_DIR}'])
698 AC_SUBST([DRI_DRIVER_SEARCH_DIR])
699 dnl Direct rendering or just indirect rendering
700 AC_ARG_ENABLE([driglx-direct],
701     [AS_HELP_STRING([--disable-driglx-direct],
702         [enable direct rendering in GLX and EGL for DRI @<:@default=enabled@:>@])],
703     [driglx_direct="$enableval"],
704     [driglx_direct="yes"])
705 dnl Which drivers to build - default is chosen by platform
706 AC_ARG_WITH([dri-drivers],
707     [AS_HELP_STRING([--with-dri-drivers@<:@=DIRS...@:>@],
708         [comma delimited DRI drivers list, e.g.
709         "swrast,i965,radeon" @<:@default=auto@:>@])],
710     [with_dri_drivers="$withval"],
711     [with_dri_drivers=yes])
712 if test "x$with_dri_drivers" = x; then
713     with_dri_drivers=no
714 fi
715
716 dnl Determine which APIs to support
717 AC_ARG_ENABLE([opengl],
718     [AS_HELP_STRING([--disable-opengl],
719         [disable support for standard OpenGL API @<:@default=no@:>@])],
720     [enable_opengl="$enableval"],
721     [enable_opengl=yes])
722 AC_ARG_ENABLE([gles1],
723     [AS_HELP_STRING([--enable-gles1],
724         [enable support for OpenGL ES 1.x API @<:@default=no@:>@])],
725     [enable_gles1="$enableval"],
726     [enable_gles1=no])
727 AC_ARG_ENABLE([gles2],
728     [AS_HELP_STRING([--enable-gles2],
729         [enable support for OpenGL ES 2.x API @<:@default=no@:>@])],
730     [enable_gles2="$enableval"],
731     [enable_gles2=no])
732 AC_ARG_ENABLE([gles-overlay],
733     [AS_HELP_STRING([--enable-gles-overlay],
734         [build separate OpenGL ES only libraries @<:@default=no@:>@])],
735     [enable_gles_overlay="$enableval"],
736     [enable_gles_overlay=no])
737
738 API_DEFINES=""
739 GLES_OVERLAY=0
740 if test "x$enable_opengl" = xno; then
741     API_DEFINES="$API_DEFINES -DFEATURE_GL=0"
742 else
743     API_DEFINES="$API_DEFINES -DFEATURE_GL=1"
744 fi
745 if test "x$enable_gles1" = xyes; then
746     API_DEFINES="$API_DEFINES -DFEATURE_ES1=1"
747 fi
748 if test "x$enable_gles2" = xyes; then
749     API_DEFINES="$API_DEFINES -DFEATURE_ES2=1"
750 fi
751 if test "x$enable_gles_overlay" = xyes -o \
752     "x$enable_gles1" = xyes -o "x$enable_gles2" = xyes; then
753     CORE_DIRS="mapi/es1api mapi/es2api $CORE_DIRS"
754     if test "x$enable_gles_overlay" = xyes; then
755         GLES_OVERLAY=1
756     fi
757 fi
758 AC_SUBST([API_DEFINES])
759 AC_SUBST([GLES_OVERLAY])
760
761 dnl If $with_dri_drivers is yes, directories will be added through
762 dnl platform checks
763 DRI_DIRS=""
764 case "$with_dri_drivers" in
765 no) ;;
766 yes)
767     DRI_DIRS="yes"
768     ;;
769 *)
770     # verify the requested driver directories exist
771     dri_drivers=`IFS=', '; echo $with_dri_drivers`
772     for driver in $dri_drivers; do
773         test -d "$srcdir/src/mesa/drivers/dri/$driver" || \
774             AC_MSG_ERROR([DRI driver directory '$driver' doesn't exist])
775     done
776     DRI_DIRS="$dri_drivers"
777     ;;
778 esac
779
780 dnl Set DRI_DIRS, DEFINES and LIB_DEPS
781 if test "$mesa_driver" = dri; then
782     # Use TLS in GLX?
783     if test "x$GLX_USE_TLS" = xyes; then
784         DEFINES="$DEFINES -DGLX_USE_TLS -DPTHREADS"
785     fi
786
787     # Platform specific settings and drivers to build
788     case "$host_os" in
789     linux*)
790         DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
791         if test "x$driglx_direct" = xyes; then
792             DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
793         fi
794         DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING -DHAVE_ALIAS"
795
796         case "$host_cpu" in
797         x86_64)
798             # sis is missing because they have not be converted to use
799             # the new interface.  i810 are missing because there is no
800             # x86-64 system where they could *ever* be used.
801             if test "x$DRI_DIRS" = "xyes"; then
802                 DRI_DIRS="i915 i965 mach64 mga r128 r200 r300 r600 radeon \
803                     savage tdfx unichrome swrast"
804             fi
805             ;;
806         powerpc*)
807             # Build only the drivers for cards that exist on PowerPC.
808             # At some point MGA will be added, but not yet.
809             if test "x$DRI_DIRS" = "xyes"; then
810                 DRI_DIRS="mach64 r128 r200 r300 r600 radeon tdfx swrast"
811             fi
812             ;;
813         sparc*)
814             # Build only the drivers for cards that exist on sparc`
815             if test "x$DRI_DIRS" = "xyes"; then
816                 DRI_DIRS="mach64 r128 r200 r300 r600 radeon swrast"
817             fi
818             ;;
819         esac
820         ;;
821     freebsd* | dragonfly*)
822         DEFINES="$DEFINES -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1"
823         DEFINES="$DEFINES -DIN_DRI_DRIVER -DHAVE_ALIAS"
824         DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING"
825         if test "x$driglx_direct" = xyes; then
826             DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
827         fi
828         if test "x$GXX" = xyes; then
829             CXXFLAGS="$CXXFLAGS -ansi -pedantic"
830         fi
831
832         if test "x$DRI_DIRS" = "xyes"; then
833             DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 r600 radeon tdfx \
834                 unichrome savage sis swrast"
835         fi
836         ;;
837     gnu*)
838         DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
839         DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING -DHAVE_ALIAS"
840         ;;
841     solaris*)
842         DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
843         DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING"
844         if test "x$driglx_direct" = xyes; then
845             DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
846         fi
847         ;;
848     esac
849
850     # default drivers
851     if test "x$DRI_DIRS" = "xyes"; then
852         DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 r600 radeon \
853             savage sis tdfx unichrome swrast"
854     fi
855
856     DRI_DIRS=`echo "$DRI_DIRS" | $SED 's/  */ /g'`
857
858     # Check for expat
859     EXPAT_INCLUDES=""
860     EXPAT_LIB=-lexpat
861     AC_ARG_WITH([expat],
862         [AS_HELP_STRING([--with-expat=DIR],
863             [expat install directory])],[
864         EXPAT_INCLUDES="-I$withval/include"
865         CPPFLAGS="$CPPFLAGS $EXPAT_INCLUDES"
866         LDFLAGS="$LDFLAGS -L$withval/$LIB_DIR"
867         EXPAT_LIB="-L$withval/$LIB_DIR -lexpat"
868         ])
869     AC_CHECK_HEADER([expat.h],[],[AC_MSG_ERROR([Expat required for DRI.])])
870     AC_CHECK_LIB([expat],[XML_ParserCreate],[],
871         [AC_MSG_ERROR([Expat required for DRI.])])
872
873     # put all the necessary libs together
874     DRI_LIB_DEPS="$SELINUX_LIBS $LIBDRM_LIBS $EXPAT_LIB -lm -lpthread $DLOPEN_LIBS $TALLOC_LIBS"
875 fi
876 AC_SUBST([DRI_DIRS])
877 AC_SUBST([EXPAT_INCLUDES])
878 AC_SUBST([DRI_LIB_DEPS])
879
880 case $DRI_DIRS in
881 *i915*|*i965*)
882     PKG_CHECK_MODULES([INTEL], [libdrm_intel >= 2.4.21])
883     ;;
884 esac
885
886 case $DRI_DIRS in
887 *radeon*|*r200*|*r300*|*r600*)
888     PKG_CHECK_MODULES([LIBDRM_RADEON],
889                       [libdrm_radeon libdrm >= $LIBDRM_RADEON_REQUIRED],
890                       HAVE_LIBDRM_RADEON=yes,
891                       HAVE_LIBDRM_RADEON=no)
892
893     if test "$HAVE_LIBDRM_RADEON" = yes; then
894         RADEON_CFLAGS="-DHAVE_LIBDRM_RADEON=1 $LIBDRM_RADEON_CFLAGS"
895         RADEON_LDFLAGS=$LIBDRM_RADEON_LIBS
896     fi
897     ;;
898 esac
899 AC_SUBST([RADEON_CFLAGS])
900 AC_SUBST([RADEON_LDFLAGS])
901
902
903 dnl
904 dnl OSMesa configuration
905 dnl
906 if test "$mesa_driver" = xlib; then
907     default_gl_osmesa=yes
908 else
909     default_gl_osmesa=no
910 fi
911 AC_ARG_ENABLE([gl-osmesa],
912     [AS_HELP_STRING([--enable-gl-osmesa],
913         [enable OSMesa with libGL @<:@default=enabled for xlib driver@:>@])],
914     [gl_osmesa="$enableval"],
915     [gl_osmesa="$default_gl_osmesa"])
916 if test "x$gl_osmesa" = xyes; then
917     if test "$mesa_driver" = osmesa; then
918         AC_MSG_ERROR([libGL is not available for OSMesa driver])
919     else
920         DRIVER_DIRS="$DRIVER_DIRS osmesa"
921     fi
922 fi
923
924 dnl Configure the channel bits for OSMesa (libOSMesa, libOSMesa16, ...)
925 AC_ARG_WITH([osmesa-bits],
926     [AS_HELP_STRING([--with-osmesa-bits=BITS],
927         [OSMesa channel bits and library name: 8, 16, 32 @<:@default=8@:>@])],
928     [osmesa_bits="$withval"],
929     [osmesa_bits=8])
930 if test "$mesa_driver" != osmesa && test "x$osmesa_bits" != x8; then
931     AC_MSG_WARN([Ignoring OSMesa channel bits for non-OSMesa driver])
932     osmesa_bits=8
933 fi
934 case "x$osmesa_bits" in
935 x8)
936     OSMESA_LIB=OSMesa
937     ;;
938 x16|x32)
939     OSMESA_LIB="OSMesa$osmesa_bits"
940     DEFINES="$DEFINES -DCHAN_BITS=$osmesa_bits -DDEFAULT_SOFTWARE_DEPTH_BITS=31"
941     ;;
942 *)
943     AC_MSG_ERROR([OSMesa bits '$osmesa_bits' is not a valid option])
944     ;;
945 esac
946 AC_SUBST([OSMESA_LIB])
947
948 case "$DRIVER_DIRS" in
949 *osmesa*)
950     # only link libraries with osmesa if shared
951     if test "$enable_static" = no; then
952         OSMESA_LIB_DEPS="-lm -lpthread $SELINUX_LIBS $DLOPEN_LIBS $TALLOC_LIBS"
953     else
954         OSMESA_LIB_DEPS=""
955     fi
956     OSMESA_MESA_DEPS=""
957     OSMESA_PC_LIB_PRIV="-lm -lpthread $SELINUX_LIBS $DLOPEN_LIBS $TALLOC_LIBS"
958     ;;
959 esac
960 AC_SUBST([OSMESA_LIB_DEPS])
961 AC_SUBST([OSMESA_MESA_DEPS])
962 AC_SUBST([OSMESA_PC_REQ])
963 AC_SUBST([OSMESA_PC_LIB_PRIV])
964
965 dnl
966 dnl EGL configuration
967 dnl
968 AC_ARG_ENABLE([egl],
969     [AS_HELP_STRING([--disable-egl],
970         [disable EGL library @<:@default=enabled@:>@])],
971     [enable_egl="$enableval"],
972     [enable_egl=yes])
973 if test "x$enable_egl" = xyes; then
974     SRC_DIRS="$SRC_DIRS egl"
975     EGL_LIB_DEPS="$DLOPEN_LIBS -lpthread"
976     EGL_DRIVERS_DIRS=""
977     if test "$enable_static" != yes; then
978         # build egl_glx when libGL is built
979         if test "$mesa_driver" != osmesa; then
980             EGL_DRIVERS_DIRS="glx"
981         fi
982
983         if test "$mesa_driver" = dri; then
984             # build egl_dri2 when xcb-dri2 is available
985             PKG_CHECK_MODULES([XCB_DRI2], [x11-xcb xcb-dri2 xcb-xfixes],
986                           [have_xcb_dri2=yes],[have_xcb_dri2=no])
987             PKG_CHECK_MODULES([LIBUDEV], [libudev > 150],
988                           [have_libudev=yes],[have_libudev=no])
989             
990             if test "$have_xcb_dri2" = yes; then
991                 EGL_DRIVER_DRI2=dri2
992                 DEFINES="$DEFINES -DHAVE_XCB_DRI2"
993                 if test "$have_libudev" = yes; then
994                     DEFINES="$DEFINES -DHAVE_LIBUDEV"
995                 fi
996             fi
997         fi
998
999         EGL_DRIVERS_DIRS="$EGL_DRIVERS_DIRS $EGL_DRIVER_DRI2"
1000     fi
1001 fi
1002 AC_SUBST([EGL_LIB_DEPS])
1003 AC_SUBST([EGL_DRIVERS_DIRS])
1004
1005 dnl
1006 dnl GLU configuration
1007 dnl
1008 AC_ARG_ENABLE([glu],
1009     [AS_HELP_STRING([--disable-glu],
1010         [enable OpenGL Utility library @<:@default=enabled@:>@])],
1011     [enable_glu="$enableval"],
1012     [enable_glu=yes])
1013 if test "x$enable_glu" = xyes; then
1014     SRC_DIRS="$SRC_DIRS glu"
1015
1016     case "$mesa_driver" in
1017     osmesa)
1018         # Link libGLU to libOSMesa instead of libGL
1019         GLU_LIB_DEPS=""
1020         GLU_PC_REQ="osmesa"
1021         if test "$enable_static" = no; then
1022             GLU_MESA_DEPS='-l$(OSMESA_LIB)'
1023         else
1024             GLU_MESA_DEPS=""
1025         fi
1026         ;;
1027     *)
1028         # If static, empty GLU_LIB_DEPS and add libs for programs to link
1029         GLU_PC_REQ="gl"
1030         GLU_PC_LIB_PRIV="-lm"
1031         if test "$enable_static" = no; then
1032             GLU_LIB_DEPS="-lm"
1033             GLU_MESA_DEPS='-l$(GL_LIB)'
1034         else
1035             GLU_LIB_DEPS=""
1036             GLU_MESA_DEPS=""
1037             APP_LIB_DEPS="$APP_LIB_DEPS -lstdc++"
1038         fi
1039         ;;
1040     esac
1041 fi
1042 if test "$enable_static" = no; then
1043     GLU_LIB_DEPS="$GLU_LIB_DEPS $OS_CPLUSPLUS_LIBS"
1044 fi
1045 GLU_PC_LIB_PRIV="$GLU_PC_LIB_PRIV $OS_CPLUSPLUS_LIBS"
1046 AC_SUBST([GLU_LIB_DEPS])
1047 AC_SUBST([GLU_MESA_DEPS])
1048 AC_SUBST([GLU_PC_REQ])
1049 AC_SUBST([GLU_PC_REQ_PRIV])
1050 AC_SUBST([GLU_PC_LIB_PRIV])
1051 AC_SUBST([GLU_PC_CFLAGS])
1052
1053 dnl
1054 dnl GLw configuration
1055 dnl
1056 AC_ARG_ENABLE([glw],
1057     [AS_HELP_STRING([--disable-glw],
1058         [enable Xt/Motif widget library @<:@default=enabled@:>@])],
1059     [enable_glw="$enableval"],
1060     [enable_glw=yes])
1061 dnl Don't build GLw on osmesa
1062 if test "x$enable_glw" = xyes && test "$mesa_driver" = osmesa; then
1063     AC_MSG_WARN([Disabling GLw since the driver is OSMesa])
1064     enable_glw=no
1065 fi
1066 AC_ARG_ENABLE([motif],
1067     [AS_HELP_STRING([--enable-motif],
1068         [use Motif widgets in GLw @<:@default=disabled@:>@])],
1069     [enable_motif="$enableval"],
1070     [enable_motif=no])
1071
1072 if test "x$enable_glw" = xyes; then
1073     SRC_DIRS="$SRC_DIRS glw"
1074     if test "$x11_pkgconfig" = yes; then
1075         PKG_CHECK_MODULES([GLW],[x11 xt])
1076         GLW_PC_REQ_PRIV="x11 xt"
1077         GLW_LIB_DEPS="$GLW_LIBS"
1078     else
1079         # should check these...
1080         GLW_LIB_DEPS="$X_LIBS -lXt -lX11"
1081         GLW_PC_LIB_PRIV="$GLW_LIB_DEPS"
1082         GLW_PC_CFLAGS="$X11_INCLUDES"
1083     fi
1084
1085     GLW_SOURCES="GLwDrawA.c"
1086     MOTIF_CFLAGS=
1087     if test "x$enable_motif" = xyes; then
1088         GLW_SOURCES="$GLW_SOURCES GLwMDrawA.c"
1089         AC_PATH_PROG([MOTIF_CONFIG], [motif-config], [no])
1090         if test "x$MOTIF_CONFIG" != xno; then
1091             MOTIF_CFLAGS=`$MOTIF_CONFIG --cflags`
1092             MOTIF_LIBS=`$MOTIF_CONFIG --libs`
1093         else
1094             AC_CHECK_HEADER([Xm/PrimitiveP.h], [],
1095                 [AC_MSG_ERROR([Can't locate Motif headers])])
1096             AC_CHECK_LIB([Xm], [XmGetPixmap], [MOTIF_LIBS="-lXm"],
1097                 [AC_MSG_ERROR([Can't locate Motif Xm library])])
1098         fi
1099         # MOTIF_LIBS is prepended to GLW_LIB_DEPS since Xm needs Xt/X11
1100         GLW_LIB_DEPS="$MOTIF_LIBS $GLW_LIB_DEPS"
1101         GLW_PC_LIB_PRIV="$MOTIF_LIBS $GLW_PC_LIB_PRIV"
1102         GLW_PC_CFLAGS="$MOTIF_CFLAGS $GLW_PC_CFLAGS"
1103     fi
1104
1105     # If static, empty GLW_LIB_DEPS and add libs for programs to link
1106     GLW_PC_LIB_PRIV="$GLW_PC_LIB_PRIV"
1107     if test "$enable_static" = no; then
1108         GLW_MESA_DEPS='-l$(GL_LIB)'
1109         GLW_LIB_DEPS="$GLW_LIB_DEPS"
1110     else
1111         APP_LIB_DEPS="$APP_LIB_DEPS $GLW_LIB_DEPS"
1112         GLW_LIB_DEPS=""
1113         GLW_MESA_DEPS=""
1114     fi
1115 fi
1116 AC_SUBST([GLW_LIB_DEPS])
1117 AC_SUBST([GLW_MESA_DEPS])
1118 AC_SUBST([GLW_SOURCES])
1119 AC_SUBST([MOTIF_CFLAGS])
1120 AC_SUBST([GLW_PC_REQ_PRIV])
1121 AC_SUBST([GLW_PC_LIB_PRIV])
1122 AC_SUBST([GLW_PC_CFLAGS])
1123
1124 dnl
1125 dnl GLUT configuration
1126 dnl
1127 if test -f "$srcdir/include/GL/glut.h"; then
1128     default_glut=yes
1129 else
1130     default_glut=no
1131 fi
1132 AC_ARG_ENABLE([glut],
1133     [AS_HELP_STRING([--disable-glut],
1134         [enable GLUT library @<:@default=enabled if source available@:>@])],
1135     [enable_glut="$enableval"],
1136     [enable_glut="$default_glut"])
1137
1138 dnl Can't build glut if GLU not available
1139 if test "x$enable_glu$enable_glut" = xnoyes; then
1140     AC_MSG_WARN([Disabling glut since GLU is disabled])
1141     enable_glut=no
1142 fi
1143 dnl Don't build glut on osmesa
1144 if test "x$enable_glut" = xyes && test "$mesa_driver" = osmesa; then
1145     AC_MSG_WARN([Disabling glut since the driver is OSMesa])
1146     enable_glut=no
1147 fi
1148
1149 if test "x$enable_glut" = xyes; then
1150     SRC_DIRS="$SRC_DIRS glut/glx"
1151     if test "$x11_pkgconfig" = yes; then
1152         PKG_CHECK_MODULES([GLUT],[x11 xmu xi])
1153         GLUT_PC_REQ_PRIV="x11 xmu xi"
1154         GLUT_LIB_DEPS="$GLUT_LIBS"
1155     else
1156         # should check these...
1157         GLUT_LIB_DEPS="$X_LIBS -lX11 -lXmu -lXi"
1158         GLUT_PC_LIB_PRIV="$GLUT_LIB_DEPS"
1159         GLUT_PC_CFLAGS="$X11_INCLUDES"
1160     fi
1161     if test "x$GCC" = xyes; then
1162         GLUT_CFLAGS="$GLUT_CFLAGS -fexceptions"
1163     fi
1164     GLUT_LIB_DEPS="$GLUT_LIB_DEPS -lm"
1165     GLUT_PC_LIB_PRIV="$GLUT_PC_LIB_PRIV -lm"
1166
1167     # If static, empty GLUT_LIB_DEPS and add libs for programs to link
1168     if test "$enable_static" = no; then
1169         GLUT_MESA_DEPS='-l$(GLU_LIB) -l$(GL_LIB)'
1170     else
1171         APP_LIB_DEPS="$APP_LIB_DEPS $GLUT_LIB_DEPS"
1172         GLUT_LIB_DEPS=""
1173         GLUT_MESA_DEPS=""
1174     fi
1175 fi
1176 AC_SUBST([GLUT_LIB_DEPS])
1177 AC_SUBST([GLUT_MESA_DEPS])
1178 AC_SUBST([GLUT_CFLAGS])
1179 AC_SUBST([GLUT_PC_REQ_PRIV])
1180 AC_SUBST([GLUT_PC_LIB_PRIV])
1181 AC_SUBST([GLUT_PC_CFLAGS])
1182
1183 dnl
1184 dnl Program library dependencies
1185 dnl    Only libm is added here if necessary as the libraries should
1186 dnl    be pulled in by the linker
1187 dnl
1188 if test "x$APP_LIB_DEPS" = x; then
1189     case "$host_os" in
1190     solaris*)
1191         APP_LIB_DEPS="-lX11 -lsocket -lnsl -lm"
1192         ;;
1193     cygwin*)
1194         APP_LIB_DEPS="-lX11"
1195         ;;
1196     *)
1197         APP_LIB_DEPS="-lm"
1198         ;;
1199     esac
1200 fi
1201 AC_SUBST([APP_LIB_DEPS])
1202 AC_SUBST([PROGRAM_DIRS])
1203
1204 dnl
1205 dnl Gallium configuration
1206 dnl
1207 AC_ARG_ENABLE([gallium],
1208     [AS_HELP_STRING([--disable-gallium],
1209         [build gallium @<:@default=enabled@:>@])],
1210     [enable_gallium="$enableval"],
1211     [enable_gallium=yes])
1212 if test "x$enable_gallium" = xyes; then
1213     SRC_DIRS="$SRC_DIRS gallium gallium/winsys gallium/targets"
1214     AC_CHECK_HEADER([udis86.h], [HAS_UDIS86="yes"],
1215                 [HAS_UDIS86="no"])
1216     AC_PATH_PROG([LLVM_CONFIG], [llvm-config], [no])
1217 fi
1218
1219 AC_SUBST([LLVM_CFLAGS])
1220 AC_SUBST([LLVM_LIBS])
1221 AC_SUBST([LLVM_LDFLAGS])
1222 AC_SUBST([LLVM_VERSION])
1223
1224 VG_LIB_DEPS=""
1225 EGL_CLIENT_APIS='$(GL_LIB)'
1226 if test "x$enable_gles_overlay" = xyes; then
1227     EGL_CLIENT_APIS="$EGL_CLIENT_APIS "'$(GLESv1_CM_LIB) $(GLESv2_LIB)'
1228 fi
1229
1230 dnl
1231 dnl Gallium state trackers configuration
1232 dnl
1233 AC_ARG_WITH([state-trackers],
1234     [AS_HELP_STRING([--with-state-trackers@<:@=DIRS...@:>@],
1235         [comma delimited state_trackers list, e.g.
1236         "egl,glx" @<:@default=auto@:>@])],
1237     [with_state_trackers="$withval"],
1238     [with_state_trackers=yes])
1239
1240 case "$with_state_trackers" in
1241 no)
1242     GALLIUM_STATE_TRACKERS_DIRS=""
1243     ;;
1244 yes)
1245     # look at what else is built
1246     case "$mesa_driver" in
1247     xlib)
1248         GALLIUM_STATE_TRACKERS_DIRS=glx
1249         ;;
1250     dri)
1251         GALLIUM_STATE_TRACKERS_DIRS="dri"
1252         HAVE_ST_DRI="yes"
1253         if test "x$enable_egl" = xyes; then
1254             GALLIUM_STATE_TRACKERS_DIRS="$GALLIUM_STATE_TRACKERS_DIRS egl"
1255             HAVE_ST_EGL="yes"
1256         fi
1257         # Have only tested st/xorg on 1.6.0 servers
1258         PKG_CHECK_MODULES(XORG, [xorg-server >= 1.6.0 libdrm >= $LIBDRM_XORG_REQUIRED libkms >= $LIBKMS_XORG_REQUIRED],
1259             HAVE_ST_XORG="yes"; GALLIUM_STATE_TRACKERS_DIRS="$GALLIUM_STATE_TRACKERS_DIRS xorg",
1260             HAVE_ST_XORG="no")
1261         ;;
1262     esac
1263     ;;
1264 *)
1265     # verify the requested state tracker exist
1266     state_trackers=""
1267     _state_trackers=`IFS=', '; echo $with_state_trackers`
1268     for tracker in $_state_trackers; do
1269         case "$tracker" in
1270         dri)
1271             if test "x$mesa_driver" != xdri; then
1272                 AC_MSG_ERROR([cannot build dri state tracker without mesa driver set to dri])
1273             fi
1274             HAVE_ST_DRI="yes"
1275             ;;
1276         egl)
1277             if test "x$enable_egl" != xyes; then
1278                 AC_MSG_ERROR([cannot build egl state tracker without EGL library])
1279             fi
1280             HAVE_ST_EGL="yes"
1281             ;;
1282         xorg)
1283             PKG_CHECK_MODULES([XORG], [xorg-server >= 1.6.0])
1284             PKG_CHECK_MODULES([LIBDRM_XORG], [libdrm >= $LIBDRM_XORG_REQUIRED])
1285             PKG_CHECK_MODULES([LIBKMS_XORG], [libkms >= $LIBKMS_XORG_REQUIRED])
1286             HAVE_ST_XORG="yes"
1287             ;;
1288         es)
1289             AC_MSG_WARN([state tracker 'es' has been replaced by --enable-gles-overlay])
1290
1291             if test "x$enable_gles_overlay" != xyes; then
1292                 if test "x$enable_gles1" != xyes -a "x$enable_gles2" != xyes; then
1293                     CORE_DIRS="mapi/es1api mapi/es2api $CORE_DIRS"
1294                 fi
1295                 GLES_OVERLAY=1
1296                 EGL_CLIENT_APIS="$EGL_CLIENT_APIS "'$(GLESv1_CM_LIB) $(GLESv2_LIB)'
1297             fi
1298             tracker=""
1299             ;;
1300         vega)
1301             CORE_DIRS="$CORE_DIRS mapi/vgapi"
1302             VG_LIB_DEPS="$VG_LIB_DEPS -lpthread"
1303             EGL_CLIENT_APIS="$EGL_CLIENT_APIS "'$(VG_LIB)'
1304             ;;
1305         esac
1306
1307         if test -n "$tracker"; then
1308             test -d "$srcdir/src/gallium/state_trackers/$tracker" || \
1309                 AC_MSG_ERROR([state tracker '$tracker' doesn't exist])
1310             if test -n "$state_trackers"; then
1311                 state_trackers="$state_trackers $tracker"
1312             else
1313                 state_trackers="$tracker"
1314             fi
1315         fi
1316     done
1317     GALLIUM_STATE_TRACKERS_DIRS="$state_trackers"
1318     ;;
1319 esac
1320
1321 AC_SUBST([VG_LIB_DEPS])
1322 AC_SUBST([EGL_CLIENT_APIS])
1323
1324 if test "x$HAVE_ST_EGL" = xyes; then
1325         GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS egl"
1326         # define GLX_DIRECT_RENDERING even when the driver is not dri
1327         if test "x$mesa_driver" != xdri -a "x$driglx_direct" = xyes; then
1328             DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
1329         fi
1330 fi
1331
1332 if test "x$HAVE_ST_XORG" = xyes; then
1333     PKG_CHECK_MODULES(XEXT, [xextproto >= 7.0.99.1],
1334         HAVE_XEXTPROTO_71="yes"; DEFINES="$DEFINES -DHAVE_XEXTPROTO_71",
1335         HAVE_XEXTPROTO_71="no")
1336 fi
1337
1338 AC_ARG_WITH([egl-platforms],
1339     [AS_HELP_STRING([--with-egl-platforms@<:@=DIRS...@:>@],
1340         [comma delimited native platforms libEGL supports, e.g.
1341         "x11,kms" @<:@default=auto@:>@])],
1342     [with_egl_platforms="$withval"],
1343     [with_egl_platforms=yes])
1344 AC_ARG_WITH([egl-displays],
1345     [AS_HELP_STRING([--with-egl-displays@<:@=DIRS...@:>@],
1346         [DEPRECATED.  Use --with-egl-platforms instead])],
1347     [with_egl_platforms="$withval"])
1348
1349 EGL_PLATFORMS=""
1350 case "$with_egl_platforms" in
1351 yes)
1352     if test "x$enable_egl" = xyes && test "x$mesa_driver" != xosmesa; then
1353         EGL_PLATFORMS="x11"
1354     fi
1355     ;;
1356 *)
1357     if test "x$enable_egl" != xyes; then
1358         AC_MSG_ERROR([cannot build egl state tracker without EGL library])
1359     fi
1360     # verify the requested driver directories exist
1361     egl_platforms=`IFS=', '; echo $with_egl_platforms`
1362     for plat in $egl_platforms; do
1363         test -d "$srcdir/src/gallium/state_trackers/egl/$plat" || \
1364             AC_MSG_ERROR([EGL platform '$plat' does't exist])
1365         if test "$plat" = "fbdev"; then
1366                 GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS sw/fbdev"
1367         fi
1368     done
1369     EGL_PLATFORMS="$egl_platforms"
1370     ;;
1371 esac
1372 AC_SUBST([EGL_PLATFORMS])
1373
1374 AC_ARG_WITH([egl-driver-dir],
1375     [AS_HELP_STRING([--with-egl-driver-dir=DIR],
1376                     [directory for EGL drivers [[default=${libdir}/egl]]])],
1377     [EGL_DRIVER_INSTALL_DIR="$withval"],
1378     [EGL_DRIVER_INSTALL_DIR='${libdir}/egl'])
1379 AC_SUBST([EGL_DRIVER_INSTALL_DIR])
1380
1381 AC_ARG_WITH([xorg-driver-dir],
1382     [AS_HELP_STRING([--with-xorg-driver-dir=DIR],
1383                     [Default xorg driver directory[[default=${libdir}/xorg/modules/drivers]]])],
1384     [XORG_DRIVER_INSTALL_DIR="$withval"],
1385     [XORG_DRIVER_INSTALL_DIR="${libdir}/xorg/modules/drivers"])
1386 AC_SUBST([XORG_DRIVER_INSTALL_DIR])
1387
1388 AC_ARG_WITH([max-width],
1389     [AS_HELP_STRING([--with-max-width=N],
1390                     [Maximum framebuffer width (4096)])],
1391     [DEFINES="${DEFINES} -DMAX_WIDTH=${withval}";
1392      AS_IF([test "${withval}" -gt "4096"],
1393            [AC_MSG_WARN([Large framebuffer: see s_tritemp.h comments.])])]
1394 )
1395 AC_ARG_WITH([max-height],
1396     [AS_HELP_STRING([--with-max-height=N],
1397                     [Maximum framebuffer height (4096)])],
1398     [DEFINES="${DEFINES} -DMAX_HEIGHT=${withval}";
1399      AS_IF([test "${withval}" -gt "4096"],
1400            [AC_MSG_WARN([Large framebuffer: see s_tritemp.h comments.])])]
1401 )
1402
1403 dnl
1404 dnl Gallium LLVM
1405 dnl
1406 AC_ARG_ENABLE([gallium-llvm],
1407     [AS_HELP_STRING([--enable-gallium-llvm],
1408         [build gallium LLVM support @<:@default=disabled@:>@])],
1409     [enable_gallium_llvm="$enableval"],
1410     [enable_gallium_llvm=auto])
1411 if test "x$enable_gallium_llvm" = xyes; then
1412     if test "x$LLVM_CONFIG" != xno; then
1413         LLVM_VERSION=`$LLVM_CONFIG --version`
1414         LLVM_CFLAGS=`$LLVM_CONFIG --cflags`
1415         LLVM_LIBS="`$LLVM_CONFIG --libs jit interpreter nativecodegen bitwriter` -lstdc++"
1416
1417         if test "x$HAS_UDIS86" != xno; then
1418             LLVM_LIBS="$LLVM_LIBS -ludis86"
1419             DEFINES="$DEFINES -DHAVE_UDIS86"
1420         fi
1421         LLVM_LDFLAGS=`$LLVM_CONFIG --ldflags`
1422         GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS llvmpipe"
1423         DEFINES="$DEFINES -DGALLIUM_LLVMPIPE -D__STDC_CONSTANT_MACROS"
1424         MESA_LLVM=1
1425     else
1426         MESA_LLVM=0
1427     fi
1428 else
1429     MESA_LLVM=0
1430 fi
1431
1432 dnl
1433 dnl Gallium helper functions
1434 dnl
1435 gallium_check_st() {
1436     if test "x$HAVE_ST_DRI" = xyes || test "x$HAVE_ST_XORG" = xyes; then
1437          GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS $1"
1438     fi
1439     if test "x$HAVE_ST_DRI" = xyes && test "x$2" != x; then
1440          GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS $2"
1441     fi
1442     if test "x$HAVE_ST_XORG" = xyes && test "x$3" != x; then
1443          GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS $3"
1444     fi
1445 }
1446
1447
1448 dnl
1449 dnl Gallium SVGA configuration
1450 dnl
1451 AC_ARG_ENABLE([gallium-svga],
1452     [AS_HELP_STRING([--enable-gallium-svga],
1453         [build gallium SVGA @<:@default=disabled@:>@])],
1454     [enable_gallium_svga="$enableval"],
1455     [enable_gallium_svga=auto])
1456 if test "x$enable_gallium_svga" = xyes; then
1457     GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS svga"
1458     gallium_check_st "svga/drm" "dri-vmwgfx" "xorg-vmwgfx"
1459 elif test "x$enable_gallium_svga" = xauto; then
1460     GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS svga"
1461 fi
1462
1463 dnl
1464 dnl Gallium i915 configuration
1465 dnl
1466 AC_ARG_ENABLE([gallium-i915],
1467     [AS_HELP_STRING([--enable-gallium-i915],
1468         [build gallium i915 @<:@default=disabled@:>@])],
1469     [enable_gallium_i915="$enableval"],
1470     [enable_gallium_i915=auto])
1471 if test "x$enable_gallium_i915" = xyes; then
1472     GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS i915/sw"
1473     GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS i915"
1474     gallium_check_st "i915/drm" "dri-i915" "xorg-i915"
1475 elif test "x$enable_gallium_i915" = xauto; then
1476     GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS i915/sw"
1477     GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS i915"
1478 fi
1479
1480 dnl
1481 dnl Gallium i965 configuration
1482 dnl
1483 AC_ARG_ENABLE([gallium-i965],
1484     [AS_HELP_STRING([--enable-gallium-i965],
1485         [build gallium i965 @<:@default=disabled@:>@])],
1486     [enable_gallium_i965="$enableval"],
1487     [enable_gallium_i965=auto])
1488 if test "x$enable_gallium_i965" = xyes; then
1489     GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS i965"
1490     gallium_check_st "i965/drm" "dri-i965" "xorg-i965"
1491 elif test "x$enable_gallium_i965" = xauto; then
1492     GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS i965"
1493 fi
1494
1495 dnl
1496 dnl Gallium Radeon configuration
1497 dnl
1498 AC_ARG_ENABLE([gallium-radeon],
1499     [AS_HELP_STRING([--enable-gallium-radeon],
1500         [build gallium radeon @<:@default=disabled@:>@])],
1501     [enable_gallium_radeon="$enableval"],
1502     [enable_gallium_radeon=auto])
1503 if test "x$enable_gallium_radeon" = xyes; then
1504     GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r300"
1505     gallium_check_st "radeon/drm" "dri-r300" "xorg-radeon"
1506 elif test "x$enable_gallium_radeon" = xauto; then
1507     GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r300"
1508 fi
1509
1510 dnl
1511 dnl Gallium Radeon r600g configuration
1512 dnl
1513 AC_ARG_ENABLE([gallium-r600],
1514     [AS_HELP_STRING([--enable-gallium-r600],
1515         [build gallium radeon @<:@default=disabled@:>@])],
1516     [enable_gallium_r600="$enableval"],
1517     [enable_gallium_r600=auto])
1518 if test "x$enable_gallium_r600" = xyes; then
1519     GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r600"
1520     gallium_check_st "r600/drm" "dri-r600"
1521 fi
1522
1523 dnl
1524 dnl Gallium Nouveau configuration
1525 dnl
1526 AC_ARG_ENABLE([gallium-nouveau],
1527     [AS_HELP_STRING([--enable-gallium-nouveau],
1528         [build gallium nouveau @<:@default=disabled@:>@])],
1529     [enable_gallium_nouveau="$enableval"],
1530     [enable_gallium_nouveau=no])
1531 if test "x$enable_gallium_nouveau" = xyes; then
1532     GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS nouveau nvfx nv50"
1533     gallium_check_st "nouveau/drm" "dri-nouveau" "xorg-nouveau"
1534 fi
1535
1536 dnl
1537 dnl Gallium swrast configuration
1538 dnl
1539 AC_ARG_ENABLE([gallium-swrast],
1540     [AS_HELP_STRING([--enable-gallium-swrast],
1541         [build gallium swrast @<:@default=auto@:>@])],
1542     [enable_gallium_swrast="$enableval"],
1543     [enable_gallium_swrast=auto])
1544 if test "x$enable_gallium_swrast" = xyes || test "x$enable_gallium_swrast" = xauto; then
1545     if test "x$HAVE_ST_DRI" = xyes; then
1546         GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS dri-swrast"
1547     fi
1548 fi
1549
1550 dnl prepend CORE_DIRS to SRC_DIRS
1551 SRC_DIRS="$CORE_DIRS $SRC_DIRS"
1552
1553 dnl Restore LDFLAGS and CPPFLAGS
1554 LDFLAGS="$_SAVE_LDFLAGS"
1555 CPPFLAGS="$_SAVE_CPPFLAGS"
1556
1557 dnl Substitute the config
1558 AC_CONFIG_FILES([configs/autoconf])
1559
1560 dnl Replace the configs/current symlink
1561 AC_CONFIG_COMMANDS([configs],[
1562 if test -f configs/current || test -L configs/current; then
1563     rm -f configs/current
1564 fi
1565 ln -s autoconf configs/current
1566 ])
1567
1568 AC_OUTPUT
1569
1570 dnl
1571 dnl Output some configuration info for the user
1572 dnl
1573 echo ""
1574 echo "        prefix:          $prefix"
1575 echo "        exec_prefix:     $exec_prefix"
1576 echo "        libdir:          $libdir"
1577 echo "        includedir:      $includedir"
1578
1579 dnl Driver info
1580 echo ""
1581 echo "        Driver:          $mesa_driver"
1582 if echo "$DRIVER_DIRS" | grep 'osmesa' >/dev/null 2>&1; then
1583     echo "        OSMesa:          lib$OSMESA_LIB"
1584 else
1585     echo "        OSMesa:          no"
1586 fi
1587 if test "$mesa_driver" = dri; then
1588     # cleanup the drivers var
1589     dri_dirs=`echo $DRI_DIRS | $SED 's/^ *//;s/  */ /;s/ *$//'`
1590 if test "x$DRI_DIRS" = x; then
1591     echo "        DRI drivers:     no"
1592 else
1593     echo "        DRI drivers:     $dri_dirs"
1594 fi
1595     echo "        DRI driver dir:  $DRI_DRIVER_INSTALL_DIR"
1596 fi
1597 echo "        Use XCB:         $enable_xcb"
1598
1599 echo ""
1600 if test "x$MESA_LLVM" = x1; then
1601     echo "        llvm:            yes"
1602     echo "        llvm-config:     $LLVM_CONFIG"
1603     echo "        llvm-version:    $LLVM_VERSION"
1604 else
1605     echo "        llvm:            no"
1606 fi
1607
1608 echo ""
1609 if echo "$SRC_DIRS" | grep 'gallium' >/dev/null 2>&1; then
1610     echo "        Gallium:         yes"
1611     echo "        Gallium dirs:    $GALLIUM_DIRS"
1612     echo "        Target dirs:     $GALLIUM_TARGET_DIRS"
1613     echo "        Winsys dirs:     $GALLIUM_WINSYS_DIRS"
1614     echo "        Driver dirs:     $GALLIUM_DRIVERS_DIRS"
1615     echo "        Trackers dirs:   $GALLIUM_STATE_TRACKERS_DIRS"
1616     if test "x$HAVE_ST_EGL" = xyes; then
1617         echo "        EGL client APIs: $EGL_CLIENT_APIS"
1618     fi
1619 else
1620     echo "        Gallium:         no"
1621 fi
1622
1623 dnl Libraries
1624 echo ""
1625 echo "        Shared libs:     $enable_shared"
1626 echo "        Static libs:     $enable_static"
1627 if test "$enable_egl" = yes; then
1628     echo "        EGL:             $EGL_DRIVERS_DIRS"
1629     echo "        EGL platforms:   $EGL_PLATFORMS"
1630 else
1631     echo "        EGL:             no"
1632 fi
1633 echo "        GLU:             $enable_glu"
1634 echo "        GLw:             $enable_glw (Motif: $enable_motif)"
1635 echo "        glut:            $enable_glut"
1636
1637 dnl Compiler options
1638 # cleanup the CFLAGS/CXXFLAGS/DEFINES vars
1639 cflags=`echo $CFLAGS $OPT_FLAGS $PIC_FLAGS $ARCH_FLAGS | \
1640     $SED 's/^ *//;s/  */ /;s/ *$//'`
1641 cxxflags=`echo $CXXFLAGS $OPT_FLAGS $PIC_FLAGS $ARCH_FLAGS | \
1642     $SED 's/^ *//;s/  */ /;s/ *$//'`
1643 defines=`echo $DEFINES $ASM_FLAGS | $SED 's/^ *//;s/  */ /;s/ *$//'`
1644 echo ""
1645 echo "        CFLAGS:          $cflags"
1646 echo "        CXXFLAGS:        $cxxflags"
1647 echo "        Macros:          $defines"
1648
1649 echo ""
1650 echo "        Run '${MAKE-make}' to build Mesa"
1651 echo ""