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