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