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